@Override protected IHandlerService getHandlerService() { return (IHandlerService) getSite().getService(IHandlerService.class); } };
private void addContributions(IToolBarManager toolBarManager) { IMenuService menuService = (IMenuService) getSite().getService( IMenuService.class); if (menuService != null && toolBarManager instanceof ContributionManager) { ContributionManager contributionManager = (ContributionManager) toolBarManager; String toolbarUri = "toolbar:" + TOOLBAR_HEADER_ID; //$NON-NLS-1$ menuService.populateContributionManager(contributionManager, toolbarUri); } }
private ISaveablesLifecycleListener getSaveablesLifecycleListener( IWorkbenchPart part) { ISaveablesLifecycleListener listener = (ISaveablesLifecycleListener) Utils .getAdapter(part, ISaveablesLifecycleListener.class); if (listener == null) listener = (ISaveablesLifecycleListener) part.getSite() .getService(ISaveablesLifecycleListener.class); return listener; }
@Override public ViewInstance createViewInstance ( final ViewManager viewManager, final ViewManagerContext viewManagerContext, final ViewInstanceDescriptor descriptor, final Composite viewHolder, final ResourceManager manager, final IWorkbenchPartSite site ) { final VisualInterfaceViewInstance instance = new VisualInterfaceViewInstance ( viewManager, viewManagerContext, viewHolder, descriptor, site.getService ( IEvaluationService.class ) ); instance.init (); return instance; }
private void activateContextService() { IContextService contextService = (IContextService) getSite() .getService(IContextService.class); if (contextService != null) contextService.activateContext(VIEW_ID); }
private void disconnectFromInput(IEditorInput oldInput) { if (oldInput != null) { if (oldInput instanceof IPropertyChangeNotifier) ((IPropertyChangeNotifier)oldInput).removePropertyChangeListener(this); // Let the workbench know that the old input's saveables are no longer needed if (knownSaveables != null && !knownSaveables.isEmpty()) { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); lifecycleListener.handleLifecycleEvent( new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, knownSaveables.toArray(new Saveable[knownSaveables.size()]), false)); knownSaveables.clear(); } } }
private ISaveablesLifecycleListener getSaveablesLifecycleListener(IWorkbenchPart part) { ISaveablesLifecycleListener listener = Adapters.adapt(part, ISaveablesLifecycleListener.class); if (listener == null) listener = part.getSite().getService(ISaveablesLifecycleListener.class); return listener; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); EContextService service = part.getSite() .getService(EContextService.class); for (String id : service.getActiveContextIds()) { System.out.println("activeContext: " + id); //$NON-NLS-1$ } return null; }
@Override public void run() { IHandlerService handlerService = getSite().getService(IHandlerService.class); try { handlerService.executeCommand(COMMAND_SAVE_TO_WORKSPACE, null); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { PDEPlugin.log(e); } } };
private void registerSaveable() { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); lifecycleListener.handleLifecycleEvent( new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_OPEN, internalGetSaveables(true), false)); }
@Override public void partDeactivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { fActive = false; IContextService contextService = getSite().getService(IContextService.class); if(contextService != null) { contextService.deactivateContext(fActivatedContext); deactivateParticipants(fActiveConsole); } } }
protected void partPropertyChanged(Object source, int propId) { firePropertyChange(propId); // Let the model manager know as well if (propId == IWorkbenchPartConstants.PROP_DIRTY) { IWorkbenchPart actualPart = getPart(false); if (actualPart != null) { SaveablesList modelManager = (SaveablesList) actualPart.getSite().getService(ISaveablesLifecycleListener.class); modelManager.dirtyChanged(actualPart); } } }
public void createPartControl(Composite parent) { parent.setData(this); fPageBook = new PageBook(parent, SWT.NONE); createCompareControl(); IContextService service = (IContextService)getSite().getService(IContextService.class); if (service != null) service.activateContext("org.eclipse.compare.compareEditorScope"); //$NON-NLS-1$ }
@Override protected void createControls(Composite composite) { super.createControls(composite); IWorkbenchPart workbenchPart= getCompareConfiguration().getContainer().getWorkbenchPart(); if (workbenchPart != null) { IContextService service= workbenchPart.getSite().getService(IContextService.class); if (service != null) { service.activateContext("org.eclipse.jdt.ui.javaEditorScope"); //$NON-NLS-1$ } } }
@Override public void createPartControl(Composite parent) { parent.setData(this); fPageBook = new PageBook(parent, SWT.NONE); createCompareControl(); IContextService service = getSite().getService(IContextService.class); if (service != null) { service.activateContext("org.eclipse.compare.compareEditorScope"); //$NON-NLS-1$ service.activateContext("org.eclipse.ui.textEditorScope"); //$NON-NLS-1$ } }
@Override protected void createControls(Composite composite) { super.createControls(composite); IWorkbenchPart workbenchPart= getCompareConfiguration().getContainer().getWorkbenchPart(); if (workbenchPart != null) { IContextService service= workbenchPart.getSite().getService(IContextService.class); if (service != null) { service.activateContext("org.eclipse.jdt.ui.javaEditorScope"); //$NON-NLS-1$ } } }
public SnippetOpenHierarchyOnSelectionAction(JavaSnippetEditor editor) { super(editor.getSite()); fEditor= editor; setResources(); setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY); ActionHandler handler = new ActionHandler(this); IHandlerService handlerService = (IHandlerService) editor.getSite().getService(IHandlerService.class); handlerService.activateHandler(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY, handler); }
/** * Creates the action group, which encapsulates all actions for the view. */ protected void makeActions() { MainActionGroup group = new MainActionGroup(this); setActionGroup(group); IHandlerService service = getSite().getService(IHandlerService.class); service.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(group.toggleLinkingAction)); collapseAllHandler = new CollapseAllHandler(viewer); service.activateHandler(CollapseAllHandler.COMMAND_ID, collapseAllHandler); }
private void updateImages(String commandId) { ICommandImageService imgService= getTextEditor().getSite().getService(ICommandImageService.class); if (imgService == null) { return; } setImageDescriptor(imgService.getImageDescriptor(commandId)); setDisabledImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_DISABLED)); setHoverImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_HOVER)); }
private void updateImages(IAction action, String commandId) { if (action.getImageDescriptor() != null) { return; } ICommandImageService imgService = getSite().getService(ICommandImageService.class); if (imgService == null) { return; } action.setImageDescriptor(imgService.getImageDescriptor(commandId)); action.setDisabledImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_DISABLED)); action.setHoverImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_HOVER)); }