Inject the MMenu in a Handler [message #761368] |
Tue, 06 December 2011 06:13  |
Eclipse User |
|
|
|
Hi!
Currently i try to inject my main menu in a handler. main reason for this is, to hide the main menu on a specific shortcut. the shortcut->command->handler mapping works fine, but only if I not try to inject the main menu. here is my handler implementation:
public class HideMenuHandler {
@Inject
@Named("menu:org.eclipse.ui.main.menu")
private MMenu menu;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
System.out.println("menu");
}
}
if i implement my handler like above, the execute method is not called. on some examples i've seen, this technique is only used in processor's. how i can get the mmenu (main menu) in to my handler?
thank you
|
|
|
|
|
Re: Inject the MMenu in a Handler [message #761418 is a reply to message #761399] |
Tue, 06 December 2011 07:58   |
Eclipse User |
|
|
|
Hi,
Hm looking at the code I see that the renderer hooks itself up
visibility changes. Now my wild guess that the case for the Root-Menu
(==MenuBar on the Shell) is not implemented.
I'd suggest to file a bug for this so that we can track why your code is
not working.
Tom
Am 06.12.11 13:31, schrieb ThomasK:
> Hi Tom,
>
> ok, i've tried the following suggestion:
>
>
> @Execute
> public void execute(MApplication application, EModelService service){
> //myTrimmedWindow
> List<MTrimmedWindow> findElements =
> service.findElements(application, "myTrimmedWindow",
> MTrimmedWindow.class, null);
> findElements.get(0).getMainMenu().setVisible(false);
> findElements.get(0).getMainMenu().setEnabled(false);
> }
>
>
> the Window is there, the MainMenu too. but none of the both methods
> (setVisible & setEnable) works. do i miss something?
>
> thank you for your help :)
|
|
|
|
Powered by
FUDForum. Page generated in 0.03956 seconds