org.eclipse.ui.contexts.IContextService#activateContext ( )源码实例Demo

下面列出了org.eclipse.ui.contexts.IContextService#activateContext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Pydev   文件: PyContextActivator.java
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;
        }
    }
}
 
源代码2 项目: goclipse   文件: LangTextMergeViewer.java
@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());
	}
 
源代码3 项目: n4js   文件: N4IDEXpectView.java
/**
 * 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);
}
 
源代码4 项目: typescript.java   文件: TypeScriptMergeViewer.java
@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$
		}
	}
}
 
源代码5 项目: tracecompass   文件: SDWidget.java
/**
 * 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);
}
 
@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$
		}
	}
}
 
源代码7 项目: sarl   文件: SARLPackageExplorerPart.java
@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();
}
 
源代码8 项目: birt   文件: GraphicalEditorWithFlyoutPalette.java
private void activateDesignerEditPart( )
{
	IContextService contextService = (IContextService) PlatformUI.getWorkbench( )
			.getService( IContextService.class );
	if ( contextActivation == null )
		contextActivation = contextService.activateContext( VIEW_CONTEXT_ID );
}
 
@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);
}
 
源代码10 项目: xds-ide   文件: XFindPanel.java
private void activateContext() {
    IContextService contextService = getService(IContextService.class);
    if (contextService != null) {
        contextActivation = contextService.activateContext(CONTEXT_ID);
    }
}
 
源代码11 项目: xds-ide   文件: UpdateManager.java
/**
 * Override standard 'Check for Updates' handler. 
 */
public static void activateXdsUpdateContext() {
   IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class);
	   activateContext = contextService.activateContext( XDS_UPDATE_CONTEXT );
}
 
源代码12 项目: KaiZen-OpenAPI-Editor   文件: JsonEditor.java
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    IContextService contextService = (IContextService) site.getService(IContextService.class);
    contextService.activateContext(CONTEXT);
}
 
源代码13 项目: e4macs   文件: EmacsPlusConsoleParticipant.java
/**
 * @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();
}