How to access to menu item? [message #924793] |
Thu, 27 September 2012 06:05 |
Gennady Gromov 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 |
Thomas Schindl 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.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04870 seconds