I have a handler which is linked to both a menu item and a toolbar icon. If the menu item is selected, a checkmark will appear to the left of the menu item. If the toolbar button is pressed in the icon changes to a 'sunken' to look like it's pushed in.
If the menu item is checkmarked I would like to 'auto-push' the toolbar button in (without firing another toolbar button-pressed event).
If the button is pressed in I would like the menu item to 'auto-checkmark'
Is there a way to do this? I assume it would start here..;
@Execute
public void execute(
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Optional MToolItem toolItem,
@Optional MMenuItem menuItem) {
// Menu triggered coming into this method
if (menuItem != null ) {
if(menuItem.isSelected()){
...
}
}
// Button triggered coming into this method
if (toolItem != null ) {
if(toolItem.isSelected()){
...
}
}
}