Identifier of a MenuItem object [message #255548] |
Fri, 25 June 2004 04:36  |
Eclipse User |
|
|
|
Originally posted by: jaitirth_shirole.hotmail.com
Hello,
I have a ViewPart class in my plug-in. This class, gets the menubar of
the active window and inspects the menus in that menu bar.
Lets say the top menu bar has:File,Edit,Window, Help items.
I get the MenuItem objects of each item by invoking menu.getItem(index).
For some reason, programmatically I want to find the unique identifier of
the MenuItem object.
I have seen the source code of MenuItem class and internally it has an
int id field, but no public access to get it.
Secondly I am doing this programmatically and I am in ViewPart class, so I
can't get the action Id associated with the MenuItem.
Is there a way to uniquely identify a MenuItem object?
Checking the label of menu is ok, but looking for any other option.
Can someone help me in answering these questions.
Thanks,
Jaitirth Shirole.
|
|
|
Re: Identifier of a MenuItem object [message #255676 is a reply to message #255548] |
Fri, 25 June 2004 13:53  |
Eclipse User |
|
|
|
Originally posted by: nick_edgar._no.spam.please_.ca.ibm.com
You are breaking the encapsulation of the workbench by doing this. Views
should not directly access the main menubar.
If you want actions associated with the view to show up in the main menubar
or toolbar, the recommended way is to
declare an action set and associate it with the view using the
actionSetPartAssociations extension point.
Also note: MenuItems do not have any unique identifier.
Nick
"Jaitirth Shirole" <jaitirth_shirole@hotmail.com> wrote in message
news:cbgo5t$aer$1@eclipse.org...
> Hello,
> I have a ViewPart class in my plug-in. This class, gets the menubar of
> the active window and inspects the menus in that menu bar.
> Lets say the top menu bar has:File,Edit,Window, Help items.
> I get the MenuItem objects of each item by invoking menu.getItem(index).
> For some reason, programmatically I want to find the unique identifier of
> the MenuItem object.
> I have seen the source code of MenuItem class and internally it has an
> int id field, but no public access to get it.
> Secondly I am doing this programmatically and I am in ViewPart class, so I
> can't get the action Id associated with the MenuItem.
> Is there a way to uniquely identify a MenuItem object?
> Checking the label of menu is ok, but looking for any other option.
>
> Can someone help me in answering these questions.
>
> Thanks,
> Jaitirth Shirole.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04087 seconds