Java Code Examples for org.eclipse.ui.contexts.IContextService#activateContext()
The following examples show how to use
org.eclipse.ui.contexts.IContextService#activateContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PyContextActivator.java From Pydev with Eclipse Public License 1.0 | 6 votes |
private void handleStateChange() { boolean isActive = false; for (IPyContextObserver obs : this.observers.getListeners()) { if (obs.isPyContextActive()) { isActive = true; break; } } IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class); //May be null on shutdown on Eclipse 4. if (contextService != null) { if (isActive) { if (activateContext == null) { activateContext = contextService.activateContext("com.python.pydev.contexts.window"); } } else { if (activateContext != null) { contextService.deactivateContext(activateContext); } activateContext = null; } } }
Example 2
Source File: LangTextMergeViewer.java From goclipse with Eclipse Public License 1.0 | 6 votes |
@Override protected void createControls(Composite composite) { super.createControls(composite); ICompareContainer container = getCompareConfiguration().getContainer(); IWorkbenchPart workbenchPart= container.getWorkbenchPart(); if (workbenchPart != null) { IContextService service= workbenchPart.getSite().getService(IContextService.class); if (service != null) { service.activateContext(EditorSettings_Actual.EDITOR_CONTEXT_ID); } } // TODO: activate Lang editor commands // IHandlerService handlerSvc = container.getServiceLocator().getService(IHandlerService.class); // handlerSvc.activateHandler(EditorCommandIds.OpenDef_ID, new OpenDefinitionHandler2()); }
Example 3
Source File: N4IDEXpectView.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Activate a context that this view uses. It will be tied to this view activation events and will be removed when * the view is disposed. * */ private void activateContext() { IContextService contextService = getSite().getService(IContextService.class); // this will get cleaned up automatically when the site // is disposed contextService.activateContext(VIEW_CONTEXT_ID); }
Example 4
Source File: TypeScriptMergeViewer.java From typescript.java with MIT License | 5 votes |
@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("ts.eclipse.ide.jsdt.ui.typeScriptEditorScope"); //$NON-NLS-1$ } } }
Example 5
Source File: SDWidget.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Sets view part. * * @param viewSite The view part to set */ public void setSite(ViewPart viewSite) { fSite = viewSite; fSite.getSite().setSelectionProvider(fSelProvider); Object serviceObject = fSite.getSite().getWorkbenchWindow().getService(IContextService.class); IContextService service = (IContextService) serviceObject; service.activateContext("org.eclipse.linuxtools.tmf.ui.view.uml2sd.context"); //$NON-NLS-1$ service.activateContext(IContextIds.CONTEXT_ID_WINDOW); }
Example 6
Source File: JavaMergeViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void createControls(Composite composite) { super.createControls(composite); IWorkbenchPart workbenchPart = getCompareConfiguration().getContainer().getWorkbenchPart(); if (workbenchPart != null) { IContextService service = (IContextService)workbenchPart.getSite().getService(IContextService.class); if (service != null) { service.activateContext("org.eclipse.jdt.ui.javaEditorScope"); //$NON-NLS-1$ } } }
Example 7
Source File: SARLPackageExplorerPart.java From sarl with Apache License 2.0 | 5 votes |
@Override public void createPartControl(Composite parent) { // Open the context final IContextService contextService = getSite().getService(IContextService.class); contextService.activateContext(CONTEXT_ID); // Overridden for setting the label provider, which is set in a private function in the super type. super.createPartControl(parent); internalResetLabelProvider(); restoreFilterAndSorter(); }
Example 8
Source File: GraphicalEditorWithFlyoutPalette.java From birt with Eclipse Public License 1.0 | 5 votes |
private void activateDesignerEditPart( ) { IContextService contextService = (IContextService) PlatformUI.getWorkbench( ) .getService( IContextService.class ); if ( contextActivation == null ) contextActivation = contextService.activateContext( VIEW_CONTEXT_ID ); }
Example 9
Source File: BonitaStudioWorkbenchAdvisor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void initialize(final IWorkbenchConfigurer configurer) { super.initialize(configurer); configurer.setSaveAndRestore(true); final IContextService contextService = PlatformUI.getWorkbench().getService(IContextService.class); contextService.activateContext("org.bonitasoft.studio.context.id"); initializeIDEImages(configurer); }
Example 10
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
private void activateContext() { IContextService contextService = getService(IContextService.class); if (contextService != null) { contextActivation = contextService.activateContext(CONTEXT_ID); } }
Example 11
Source File: UpdateManager.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
/** * Override standard 'Check for Updates' handler. */ public static void activateXdsUpdateContext() { IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class); activateContext = contextService.activateContext( XDS_UPDATE_CONTEXT ); }
Example 12
Source File: JsonEditor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 4 votes |
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IContextService contextService = (IContextService) site.getService(IContextService.class); contextService.activateContext(CONTEXT); }
Example 13
Source File: EmacsPlusConsoleParticipant.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.ui.console.IConsolePageParticipant#activated() */ public void activated() { IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class); fContextActivation = contextService.activateContext("org.eclipse.ui.textEditorScope"); //$NON-NLS-1$ ((EmacsPlusConsole)console).onLine(); }