private void createCommands() { for (MCommand cmdModel : application.getCommands()) { createCommand(cmdModel); } }
protected MCommand findCommand(String commandId) { for (MCommand cmd : application.getCommands()) { if (commandId.equals(cmd.getElementId())) { return cmd; } } return null; }
public static MCommand getMCommand(MApplication application, CommandContributionItem contribution) { ParameterizedCommand command = contribution.getCommand(); if (command != null) { for (MCommand mcommand : application.getCommands()) { if (mcommand.getElementId().equals(command.getId())) { return mcommand; } } } return null; }
List<MCommand> commands = application.getCommands(); Set<MCommand> toBeRemoved = new HashSet<>(); for (MCommand command : commands) {
application.getCommands().add(command); commands.put(command.getElementId(), command); } catch (NotDefinedException e) {
@Execute void process(MApplication application, IEclipseContext context, EModelService modelService) { this.modelService = modelService; for (MCategory catModel : application.getCategories()) { categories.put(catModel.getElementId(), catModel); } for (MCommand cmdModel : application.getCommands()) { commands.put(cmdModel.getElementId(), cmdModel); } CommandManager commandManager = context.get(CommandManager.class); if (commandManager == null) { HandlerServiceImpl.handlerGenerator = new ContextFunction() { @Override public Object compute(IEclipseContext context, String contextKey) { return new WorkbenchHandlerServiceHandler(contextKey); } }; commandManager = new CommandManager(); // setCommandFireEvents(commandManager, false); context.set(CommandManager.class, commandManager); } CommandPersistence cp = new CommandPersistence(commandManager); cp.reRead(); generateCategories(application, commandManager); generateCommands(application, commandManager); cp.dispose(); }
cmd.setCommandName(text); cmd.setElementId(cmdId); app.getCommands().add(cmd);
@Execute void process(final MApplication application, IEclipseContext context) { gatherContexts(application.getRootContext()); gatherCommands(application.getCommands()); gatherTables(application.getBindingTables());
@SuppressWarnings("restriction") @Override public void commandManagerChanged(CommandManagerEvent commandManagerEvent) { if (commandManagerEvent.isCommandChanged()) { if (commandManagerEvent.isCommandDefined()) { final String commandId = commandManagerEvent.getCommandId(); if (findCommand(commandId) != null) { return; } final Command command = commandManagerEvent.getCommandManager().getCommand( commandId); if (command.getHandler() == null) { command.setHandler(HandlerServiceImpl.getHandler(commandId)); } try { MCategory categoryModel = findCategory(command.getCategory().getId()); final MCommand createdCommand = createCommand(command, modelService, categoryModel); application.getCommands().add(createdCommand); } catch (NotDefinedException e) { Activator.getDefault().getLogService() .log(0, "Failed to create command " + commandId, e); //$NON-NLS-1$ } } } } };
children.addAll(app.getHandlers()); } else if (clazz.equals(MCommand.class)) { children.addAll(app.getCommands()); } else if (clazz.equals(MBindingContext.class)) { children.addAll(app.getBindingContexts());
commandById.setElementId(commandId); commandById.setCommandName(commandId); application.getCommands().add(commandById);
cmd.setCommandName(text); cmd.setElementId(cmdId); app.getCommands().add(cmd);
application.getCommands().removeAll(commandsToRemove); application.getCategories().removeAll(categoriesToRemove); getDisplay().removeFilter(SWT.MouseDown, backForwardListener);
commandById.setElementId(commandId); commandById.setCommandName(commandId); application.getCommands().add(commandById);
String id = action.getActionDefinitionId(); if (action instanceof OpenPreferencesAction) { for (MCommand command : application.getCommands()) { if (IWorkbenchCommandConstants.WINDOW_PREFERENCES.equals(command.getElementId())) { MHandledMenuItem menuItem = MenuFactoryImpl.eINSTANCE.createHandledMenuItem(); for (MCommand command : application.getCommands()) { if (id.equals(command.getElementId())) { MHandledMenuItem menuItem = MenuFactoryImpl.eINSTANCE.createHandledMenuItem();
String id = action.getActionDefinitionId(); if (id != null) { for (MCommand command : application.getCommands()) { if (id.equals(command.getElementId())) { MHandledToolItem toolItem = MenuFactoryImpl.eINSTANCE.createHandledToolItem();