Which Context Menu Item Clicked - iphone

I am trying to develop a ios application. I could get the context menu up and running in few minutes.
Now to scale the context menu feature, I want to make UIMenuItem hold the information about it action, I wrote a class.
ExampleMenuItem : UiMenuItem
#private int action
Now the problem is as I generate MenuItem dynamically and specify only one selector in action menuItemClicked: , I am unable to know which MenuItem is being clicked to get the relevant action information.
Any idea would be appreciated. I tried enough of Google and Stackoverflow searching before writing this post.
Thanks
Hemant Verma

Related

Change menus and menu items programmatically in Eclipse E4

I am having trouble removing existing menus from the model, in a running app.
For example:
MMenu menu = modelService.findElements(app, "idMenuFoo", MMenu.class,
Collections.<String>emptyList(), EModelService.IN_MAIN_MENU).get(0);
menu.setLabel("X");
menu.setVisible(false);
menu.setToBeRendered(false);
After this code gets executed:
The label has been changed to 'X'
But the menu entry is still visible/rendered
If I start the app without clearPersistedState, then restart it, the menu has disappeared. This leads me to be believe the the visibility and rendering attributes were set in the first place, but not applied to the model (unlike the label attribute).
How can I programmatically trigger a main menu bar "refresh" after such changes?
As a Greg in the comment above posted, there is an open bug filed to address this issue. An easy to implement a workaround involves manually refreshing the underlying SWT menu. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=365724#c9 for details. In a gist:
// retrieve the main menu, containing the top-level menu element that needs to be refreshed
MMenu mainMenu = ...
// org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer
MenuManagerRender renderer = (MenuManagerRenderer)mainMenu.getRenderer();
renderer.getManager(mainMenu).update(true);

Add items to menu in webworks app

I was wondering how I would go about adding items to the menu that appears when the blackberry button http://jennontech.files.wordpress.com/2012/10/blackberry-logo.jpg is clicked. Thanks to anyone who can help. Btw, I am making an app for blackberry 7, if that helps.
The easiest way to approach this is to have a look at the menu sample for WebWorks available at http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Adding-Menu-Items-using-the-BlackBerry-WebWorks-SDK/ta-p/516885
If you want to understand deeper the API this is the page you should look at:
https://developer.blackberry.com/bbos/html5/apis/blackberry.ui.menu.html
A quick overview is:
1. you create the menu item
var reloadButton = new blackberry.ui.menu.MenuItem(false, 0, "Refresh", reloadPage);
2. you add the reloadButton item menu to the context menu
blackberry.ui.menu.clearMenuItems();
blackberry.ui.menu.addMenuItem(reloadButton);
That's it! You can optionally specify which menu item is the default one with
blackberry.ui.menu.setDefaultMenuItem(reloadButton);
Check out the API page for more details.
As a reminder, the ideal place to get the BlackBerry experts support for your queries is the BlackBerry forum http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/bd-p/browser_dev

In Fiddler, how can I edit the session context menu?

What I am wondering is, how can I edit an already existent item in the context menu that opens up when a session that has been selected is right clicked? Specifically speaking, I am looking to change the text for the item "Unlock For Editing" through the Fiddler2 Script Editor. This seems quite simple, but I when looking through FiddlerApplication.UI, the only thing I can find relating to a context menu strip is FiddlerApplication.UI.ContextMenuStrip and I don't see any items within the direct members. Maybe I am looking over something, but all I know is that I can't find the item for which text should be "Unlock For Editing". Also, if somebody does know what I am talking about, I have yet one more question; how can I make something happen upon the event of the context menu being opened, and without overriding the original code for the opening event method? Thank you for any help!
Update to the earlier post:
I have found the direct member to the ContextMenu that I was looking for.
The ContextMenu member for the session list was inside of the SessionListView data member for the list of sessions, which member is named FiddlerApplication.UI.lvSessions.
You didn't say why you hope to do this?
Changing existing menu items isn't a supported action and while it's not hard to do so in a "hacky" way, that hack is very likely to break in a future update to Fiddler.
In contrast, adding new items to the context menu is supported and is accomplished by adding a ContextAction attribute on a method in your FiddlerScript.

How would one implement a sliding 2 button menu like this from Lift?

http://imgur.com/3ZBCsDn
Can't post the image on the site but there it is.
I have been trying to find if this is a template or a separate nib file ala the page turn animation. Any help would be greatly appreciated.
That is called a UIActionSheet. It is created entirely in code, so it's limited to some pretty simple stuff (i.e. a few buttons, one of which is the cancel button, and one of which can be marked "destructive"). Just consult the documentation for the UIActionSheet class; it tells you all there is to know about it.
Also, here's the discussion in my book:
http://www.apeth.com/iOSBook/ch26.html#_action_sheet

Eclipse RCP get elements by ID

I don't know RCP very well yet, but I've been reading a lot of the docs. I don't know if my question makes sense; I apologize if not and beg that you try to work out what I mean and come up with some kind of answer.
I have a tree view element, which has a double click listener on it. In another part of the window there is a layout folder which contains views that are supposed to be inspectors for the items double-clicked on.
The only way I know to make another inspector appear is:
getActivePage().showView(Inspector.ID).
showView() doesn't give any opportunity to pass extra information to the view, so can it know which element to inspect?
Pointers in different directions appreciated. The Vogel tutorial doesn't seem to cover this, or I don't understand it.
You could check if the article "Link to Editor" can help you here.
That is, instead of trying to access the right view, define a Listener for the Editors:
private IPartListener2 partListener2 = new IPartListener2() {
public void partActivated(IWorkbenchPartReference ref) {
if (ref.getPart(true) instanceof IEditorPart)
editorActivated(getViewSite().getPage().getActiveEditor());
}
That way, you can get back the right Editor, and ask that Editor all you need for your View to update accordingly.
You can use the SelectionService. The Inspector view should register as a SelectionListener. And the other view with the tree should register a SelectionProvider. This view should listen for the double click in the tree and then update the selection