@Override public void addAction(final IAction action) { Check.notNull(action, "action"); //$NON-NLS-1$ final String commandId = action.getActionDefinitionId(); if (commandId == null) { throw new IllegalArgumentException("action does not have an action definition ID set"); //$NON-NLS-1$ } final IHandler handler = new ActionHandler(action); final HandlerSubmission handlerSubmission = new HandlerSubmission(null, shell, site, commandId, handler, Priority.MEDIUM); workbenchCommandSupport.addHandlerSubmission(handlerSubmission); handlerSubmissions.add(handlerSubmission); }
@Override public void dispose() { for (final Iterator it = handlerSubmissions.iterator(); it.hasNext();) { final HandlerSubmission handlerSubmission = (HandlerSubmission) it.next(); workbenchCommandSupport.removeHandlerSubmission(handlerSubmission); handlerSubmission.getHandler().dispose(); } handlerSubmissions.clear(); }