private int addAction(IMenuManager menu, IAction action) { if (action != null && action.isEnabled()) { menu.add(action); return 1; } return 0; }
/** * Registers the given action with the workbench command support. * * @param action the action to register. */ private void registerKeybindings(IAction action) { final IHandler handler = new ActionHandler(action); final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class); final IHandlerActivation activation = handlerService.activateHandler( action.getActionDefinitionId(), handler, new ActiveShellExpression(dialog.getShell())); activations.add(activation); }