@Override public <T> T getService(final Class<T> key) { return viewSite.getService(key); }
public void dispose() { IHandlerService service = fViewSite.getService(IHandlerService.class); service.deactivateHandler(fHandlerActivation); }
public void linkActivated(HyperlinkEvent e) { IHandlerService service = (IHandlerService) getViewSite() .getService(IHandlerService.class); UIUtils.executeCommand(service, "org.eclipse.egit.ui.RepositoriesViewAddRepository"); //$NON-NLS-1$ } });
public void linkActivated(HyperlinkEvent e) { IHandlerService service = (IHandlerService) getViewSite() .getService(IHandlerService.class); UIUtils.executeCommand(service, "org.eclipse.egit.ui.RepositoriesViewCreateRepository"); //$NON-NLS-1$ } });
public void linkActivated(HyperlinkEvent e) { IHandlerService service = (IHandlerService) getViewSite() .getService(IHandlerService.class); UIUtils.executeCommand(service, "org.eclipse.egit.ui.RepositoriesViewClone"); //$NON-NLS-1$ } });
private void executeOpenCommand() { IHandlerService srv = (IHandlerService) getViewSite() .getService(IHandlerService.class); try { srv.executeCommand("org.eclipse.egit.ui.RepositoriesViewOpen", null); //$NON-NLS-1$ } catch (Exception e) { Activator.handleError(e.getMessage(), e, false); } }
@Override public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); commonInit(site); preferenceInit(site); fContextService = site.getService(IContextService.class); }
@Override public void init(IViewSite site) throws PartInitException { super.init(site); commonInit(site); preferenceInit(site); fContextService = site.getService(IContextService.class); }
/** * Creates a new sub view site of the given parent view site. * * @param parentViewSite * the parent view site */ public PageSite(final IViewSite parentViewSite) { Assert.isNotNull(parentViewSite); parentSite = parentViewSite; subActionBars = new SubActionBars(parentViewSite.getActionBars(), this); // Initialize the service locator. IServiceLocatorCreator slc = parentSite .getService(IServiceLocatorCreator.class); e4Context = ((PartSite) parentViewSite).getContext().createChild("PageSite"); //$NON-NLS-1$ this.serviceLocator = (ServiceLocator) slc.createServiceLocator(parentViewSite, null, () -> { // final Control control = // ((PartSite)parentViewSite).getPane().getControl(); // if (control != null && !control.isDisposed()) { // ((PartSite)parentViewSite).getPane().doHide(); // } // TODO compat: not tsure what this should do }, e4Context); initializeDefaultServices(); }
public DetailPaneAssignValueAction(ITextViewer textViewer, IViewSite viewSite) { super(ActionMessages.DetailPaneAssignValueAction_1); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_ASSIGN_VALUE_ACTION); fTextViewer = textViewer; fViewSite = viewSite; setEnabled(false); IHandlerService service = fViewSite.getService(IHandlerService.class); ActionHandler handler = new ActionHandler(this); fHandlerActivation = service.activateHandler(getActionDefinitionId(), handler); }
@Override protected void handleDoubleClick(DoubleClickEvent anEvent) { ICommandService commandService = getViewSite().getService(ICommandService.class); Command openProjectCommand = commandService.getCommand(IWorkbenchCommandConstants.PROJECT_OPEN_PROJECT); if (openProjectCommand != null && openProjectCommand.isHandled() && openProjectCommand.isEnabled()) { IStructuredSelection selection = (IStructuredSelection) anEvent .getSelection(); Object element = selection.getFirstElement(); if (element instanceof IProject && !((IProject) element).isOpen()) { try { openProjectCommand.executeWithChecks(new ExecutionEvent()); } catch (CommandException ex) { IStatus status = WorkbenchNavigatorPlugin.createErrorStatus("'Open Project' failed", ex); //$NON-NLS-1$ WorkbenchNavigatorPlugin.getDefault().getLog().log(status); } return; } } super.handleDoubleClick(anEvent); }
/** * Add the actions to the toolbar * * @param bars the action bars */ protected void configureToolBar(IActionBars bars) { IToolBarManager mgr = bars.getToolBarManager(); mgr.add(fPageDropDown); mgr.add(fPinAction); IMenuManager menu = bars.getMenuManager(); menu.add(fPinAction); menu.add(fToggleLinkingAction); menu.add(fRemoveCurrentAction); menu.add(fRemoveAllAction); IHandlerService handlerService= this.getViewSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction)); handlerService.activateHandler(ActionFactory.PASTE.getCommandId(), new ActionHandler(fPastePatchAction)); }
private void setGlobalActionHandlers(IActionBars actionBars) { // Navigate Go Into and Go To actions. actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, fZoomInAction); actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction); actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForwardAction); actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UP, fUpAction); actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_TO_RESOURCE, fGotoResourceAction); actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_TYPE, fGotoTypeAction); actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_PACKAGE, fGotoPackageAction); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction); fRefactorActionGroup.retargetFileMenuActions(actionBars); IHandlerService handlerService= fPart.getViewSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction)); handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction)); }
private void setGlobalActionHandlers(IActionBars actionBars) { // Navigate Go Into and Go To actions. actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, fZoomInAction); actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction); actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForwardAction); actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UP, fUpAction); actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_TO_RESOURCE, fGotoResourceAction); actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_TYPE, fGotoTypeAction); actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_PACKAGE, fGotoPackageAction); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction); fRefactorActionGroup.retargetFileMenuActions(actionBars); IHandlerService handlerService= fPart.getViewSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction)); handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction)); }
IHandlerService service = getViewSite().getService(IHandlerService.class); service.deactivateHandler(fContentAssistActivation); fContentAssistActivation = null;
IMenuService menuService = site.getService(IMenuService.class);
getViewSite().getPage().addPartListener(fPartListener); activateHandlers(getViewSite().getService(IHandlerService.class)); fillActionBars(getViewSite().getActionBars());
getViewSite().getPage().addPartListener(fPartListener); activateHandlers(getViewSite().getService(IHandlerService.class)); fillActionBars(getViewSite().getActionBars());
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_CONTENT_ASSIST_ACTION); ActionHandler actionHandler = new ActionHandler(textAction); IHandlerService handlerService = getViewSite().getService(IHandlerService.class); fContentAssistActivation = handlerService.activateHandler(textAction.getActionDefinitionId(), actionHandler); setAction(DETAIL_CONTENT_ASSIST_ACTION, textAction);
IHandlerService handlerService= getViewSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));