/** * @param handler * @param context */ private void processActiveHandler(MHandler handler, IEclipseContext context) { MCommand command = handler.getCommand(); if (command != null) { String commandId = command.getElementId(); if (handler.getObject() == null) { IContributionFactory contributionFactory = (IContributionFactory) context .get(IContributionFactory.class.getName()); handler.setObject(contributionFactory.create(handler.getContributionURI(), context)); } EHandlerService handlerService = (EHandlerService) context.get(EHandlerService.class .getName()); handlerService.activateHandler(commandId, handler.getObject()); } }
dialogbutton.getStyleClass().add("dialog-opener"); //$NON-NLS-1$ String commandId = handlerContainer.getHandlers().stream().filter(h -> h.getContributionURI().endsWith("org.eclipse.fx.ui.workbench.fx.perspective.SwitchPerspectiveDialogHandler")) //$NON-NLS-1$ .findFirst().map(h -> h.getCommand().getElementId()).orElse(null); commandId = window.getHandlers().stream().filter(h -> h.getContributionURI().endsWith("org.eclipse.fx.ui.workbench.fx.perspective.SwitchPerspectiveDialogHandler")) //$NON-NLS-1$ .findFirst().map(h -> h.getCommand().getElementId()).orElse(null); commandId = application.getHandlers().stream().filter(h -> h.getContributionURI().endsWith("org.eclipse.fx.ui.workbench.fx.perspective.SwitchPerspectiveDialogHandler")) //$NON-NLS-1$ .findFirst().map(h -> h.getCommand().getElementId()).orElse(null);
IEclipseContext context = mContext.getContext(); if (context != null) { MCommand command = handler.getCommand(); if (command != null) { String commandId = command.getElementId(); EHandlerService handlerService = (EHandlerService) context .get(EHandlerService.class.getName()); handlerService.deactivateHandler(commandId, handler.getObject());
while (i.hasNext() && removed < 4) { MHandler handler = i.next(); if (toBeRemoved.contains(handler.getCommand())) { i.remove(); removed++;