Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to access to menu item?
How to access to menu item? [message #924793] Thu, 27 September 2012 06:05 Go to next message
Gennady Gromov is currently offline Gennady GromovFriend
Messages: 24
Registered: May 2011
Junior Member
To change some properties of menu item programmatically (visible, label, selected etc.) I need to have the instance of this menu item (MHandledMenuItem or MDirectMenuItem).
I tried in the handler:

@Inject
@Named("menuItemId")
MHandledMenuItem menuItem;


- no result,

@Execute
public void execute(EModelService service, MApplication application) {
MUIElement element = service.find("menuItemId", application);
}


- element is null (tried the window in place of application too),


@Execute
public void execute(EModelService service, MApplication application) {
List<MHandledMenuItem> list = service.findElements(application, "menuItemId", MHandledMenuItem.class, null);
}


- list is empty.

The EMenuServise don't allow this.

What should I do?

I didn't find the answer to this question in internet and accessible tutorials.
Re: How to access to menu item? [message #924826 is a reply to message #924793] Thu, 27 September 2012 06:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Wild guess is that the EModelService is not searching through the
Main-Menu structure (which i'd consider a bug!). So you need to traverse
the MApplication-Element your own.

Tom

Am 27.09.12 08:05, schrieb Gennady Gromov:
> To change some properties of menu item programmatically (visible, label,
> selected etc.) I need to have the instance of this menu item
> (MHandledMenuItem or MDirectMenuItem).
> I tried in the handler:
>
> @Inject
> @Named("menuItemId")
> MHandledMenuItem menuItem;
>
> - no result,
>
> @Execute
> public void execute(EModelService service, MApplication application) {
> MUIElement element = service.find("menuItemId", application);
> }
>
> - element is null (tried the window in place of application too),
>
>
> @Execute
> public void execute(EModelService service, MApplication application) {
> List<MHandledMenuItem> list = service.findElements(application,
> "menuItemId", MHandledMenuItem.class, null);
> }
>
> - list is empty.
>
> The EMenuServise don't allow this.
>
> What should I do?
> I didn't find the answer to this question in internet and accessible
> tutorials.
Re: How to access to menu item? [message #924888 is a reply to message #924826] Thu, 27 September 2012 08:01 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=383403
Re: How to access to menu item? [message #925011 is a reply to message #924888] Thu, 27 September 2012 10:01 Go to previous messageGo to next message
Gennady Gromov is currently offline Gennady GromovFriend
Messages: 24
Registered: May 2011
Junior Member
As I understood from this link, it is impossible now by the EModelService.
May be there is another way to get the instance of menu item?
Re: How to access to menu item? [message #925083 is a reply to message #925011] Thu, 27 September 2012 10:59 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes get the MApplication and search you own following its children, .... .

Tom

Am 27.09.12 12:01, schrieb Gennady Gromov:
> As I understood from this link, it is impossible now by the
> EModelService. May be there is another way to get the instance of menu
> item?
Previous Topic:Handler executes on rcp launch
Next Topic:Tycho and OS X code signing
Goto Forum:
  


Current Time: Tue Apr 23 07:13:21 GMT 2024

Powered by FUDForum. Page generated in 0.03183 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top