How to access to menu item? [message #924793] |
Thu, 27 September 2012 02:05  |
Eclipse User |
|
|
|
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 02:43   |
Eclipse User |
|
|
|
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 #925083 is a reply to message #925011] |
Thu, 27 September 2012 06:59  |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03617 seconds