|
|
|
Re: Remove E4 menu item programmatically [message #1739460 is a reply to message #1739435] |
Mon, 01 August 2016 22:34 |
Denis Forveille Messages: 10 Registered: July 2016 |
Junior Member |
|
|
Another (easier?) way of doing it is to add a method anotated with @CanExecute in your handler linked to the command associated with the menuItem, to inject the menu item and disable it based on some logic. If the method annotated with "@CanExecute" returns false, the method annotated with "@Execute" will not be called
@Execute
public void execute(final MApplication application, final EModelService service, final Display display) {
<logic associated to the menuItem>
}
@CanExecute
public boolean canExecute(MMenuItem menuItem) {
menuItem.setVisible(false);
return false;
}
[Updated on: Mon, 01 August 2016 22:36] Report message to a moderator
|
|
|
Re: Remove E4 menu item programmatically [message #1739466 is a reply to message #1739460] |
Tue, 02 August 2016 06:38 |
Alexander Fichtinger Messages: 66 Registered: January 2013 |
Member |
|
|
Hy guys,
the second answer was also very helpful.
Now we developed the following solution (maybe this helps someone else too =) ):
- We are defining an Eclipse Activity
- Then we are checking the activityPatternBindings programmatically in the @CanExecute method
- If a certain binding is set we are enabling or disabling the menu item with the removeCommand() method.
The reason that we wanted to use Eclipse Activities is, that this is the easiest way for our customer to customize his own product version.
This works really fine!
Thanks again =) =)
[Updated on: Tue, 02 August 2016 06:41] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03047 seconds