Java 类org.eclipse.ui.contexts.IContextService 实例源码

项目:DarwinSPL    文件:DwprofileEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("de.darwinspl.preferences.resource.dwprofile.EditorScope");
}
项目:DarwinSPL    文件:HyexpressionEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.expression.resource.hyexpression.EditorScope");
}
项目:DarwinSPL    文件:HyvalidityformulaEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.context.contextValidity.resource.hyvalidityformula.EditorScope");
}
项目:DarwinSPL    文件:HydatavalueEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.dataValues.resource.hydatavalue.EditorScope");
}
项目:DarwinSPL    文件:HymappingEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.mapping.resource.hymapping.EditorScope");
}
项目:DarwinSPL    文件:HyconstraintsEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.constraint.resource.hyconstraints.EditorScope");
}
项目:DarwinSPL    文件:HymanifestEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.mspl.manifest.resource.hymanifest.EditorScope");
}
项目: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;
        }
    }
}
项目: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());
    }
项目: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);
}
项目:n4js    文件:N4JSApplicationWorkbenchWindowAdvisor.java   
private void initN4Context() {
    if (isWorkbenchRunning()) {
        final IWorkbench workbench = getWorkbench();
        workbench.getDisplay().asyncExec(() -> {
            final IContextService service = workbench.getService(IContextService.class);
            service.activateContext(N4_CONTEXT_ID);
        });
    }
}
项目:pgcodekeeper    文件:SQLEditor.java   
@Override
public void createPartControl(Composite parent) {
    parentComposite = parent;
    super.createPartControl(parent);
    setLineBackground();
    getSite().getService(IContextService.class).activateContext(CONTEXT.EDITOR);
}
项目:pandionj    文件:PandionJView.java   
@Override
public void createPartControl(Composite parent) {
    contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class);
    createWidgets(parent);

    debugEventListener = new DebugListener();
    DebugPlugin.getDefault().addDebugEventListener(debugEventListener);

    breakpointListener = new PandionJBreakpointListener();
    JDIDebugModel.addJavaBreakpointListener(breakpointListener);

    //      populateToolBar();

    addErrorReporting();
}
项目:avro-schema-editor    文件:AvroSchemaEditorPart.java   
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {

    setSite(site);
       setInput(input);
       setTitleImage(input.getImageDescriptor().createImage());
       setPartName(input.getName());

       // initialize the context bindings for this editor. Useful for shortcuts
       IContextService service = (IContextService) site.getService(IContextService.class);
       service.activateContext(CONTEXT_ID);

       // get the input
       avroSchema = getAvroSchema();

       // load the configurations
       IEditorConfiguration editorConfiguration = loadEditorConfiguration();
       SchemaViewerConfiguration schemaViewerConfiguration = loadSchemaViewerConfiguration();
       AttributesConfiguration attributesConfiguration = loadAttributesConfiguration();

       // create and configure the main component
       editor = new AvroSchemaEditor(input.getName(), getContextId(), this);        
       editor.setEditorConfiguration(editorConfiguration);
       editor.setSchemaViewerConfiguration(schemaViewerConfiguration);
       editor.setAttributesConfiguration(attributesConfiguration);
       editor.setInput(avroSchema);

       editor.addDirtyListener(this);

}
项目: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$
        }
    }
}
项目:velocity-edit    文件:VelocityEditor.java   
public void focusGained(FocusEvent e) {
    ConfigurationManager.getInstance(getProject()).clearProjectClassLoader();

    IContextService contextService = (IContextService)PlatformUI.getWorkbench()
            .getService(IContextService.class);
    contextService.activateContext("com.hudson.velocityweb.velocityContext");
}
项目:OpenSPIFe    文件:TimelineEditorPart.java   
@Override
protected void setSite(IWorkbenchPartSite newSite) {
    newSite.setSelectionProvider(new EnsembleSelectionProvider(this.toString()));
    super.setSite(newSite);
    IContextService contextService = (IContextService)newSite.getService(IContextService.class);
    contextService.activateContext("timeline");
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaMergeViewer.java   
@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$
        }
    }
}
项目:idecore    文件:ForceIdePerspectiveListener.java   
@Override
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
    if (perspective.getId().equals(Constants.FORCE_PLUGIN_PERSPECTIVE)) {
        page.getWorkbenchWindow().getService(IContextService.class).getActiveContextIds();
        activateForceContext();
    } else {
        deactivateForceContext();
    }
}
项目:idecore    文件:ForceIdePerspectiveListener.java   
public void activateForceContext() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IContextService service = workbench.getService(IContextService.class);
    if (!service.getActiveContextIds().contains(Constants.FORCE_PLUGIN_CONTEXT_ID)) {
        forceContext = service.activateContext(Constants.FORCE_PLUGIN_CONTEXT_ID);      
    }
}
项目:idecore    文件:ForceIdePerspectiveListener.java   
public void deactivateForceContext() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IContextService service = workbench.getService(IContextService.class);
    if (service.getActiveContextIds().contains(Constants.FORCE_PLUGIN_CONTEXT_ID)) {
        service.deactivateContext(forceContext);
        forceContext = null;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaMergeViewer.java   
@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$
        }
    }
}
项目:eclipse-timekeeper    文件:WorkWeekView.java   
/**
 * Passing the focus request to the viewer's control.
 */
@Override
public void setFocus() {
    viewer.getControl().setFocus();
    IContextService contextService = PlatformUI.getWorkbench().getService(IContextService.class);
    contextService.activateContext("net.resheim.eclipse.timekeeper.ui.workweek");
}
项目:rustyeclipse    文件:RustEditor.java   
@Override
public void init(@Nullable IEditorSite site, @Nullable IEditorInput input) throws PartInitException {
    super.init(site, input);

       IContextService cs = (IContextService)getSite().getService(IContextService.class);
       cs.activateContext(EDITOR_SCOPE);
}
项目:eclipsensis    文件:InstallOptionsDesignEditor.java   
/**
 * Sets the site and input for this editor then creates and initializes the actions.
 * @see org.eclipse.ui.IEditorPart#init(IEditorSite, IEditorInput)
 */
@Override
public void init(IEditorSite site, IEditorInput input)
{
    setSite(site);
    setInput(input);
    getCommandStack().addCommandStackListener(this);
    ((IContextService)site.getService(IContextService.class)).activateContext(EDITING_INSTALLOPTIONS_DESIGN_CONTEXT_ID);
    initializeActionRegistry();
}
项目:tmxeditor8    文件:TeStartup.java   
public void earlyStartup() {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    workbench.getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
            IContextService contextService = (IContextService) workbench.getService(IContextService.class);
            if(contextService != null){
                contextService.activateContext("net.heartsome.cat.te.context");
            }
        }
    });
}
项目:birt    文件:GraphicalEditorWithFlyoutPalette.java   
private void activateDesignerEditPart( )
{
    IContextService contextService = (IContextService) PlatformUI.getWorkbench( )
            .getService( IContextService.class );
    if ( contextActivation == null )
        contextActivation = contextService.activateContext( VIEW_CONTEXT_ID );
}
项目:birt    文件:GraphicalEditorWithFlyoutPalette.java   
private void deActivateDesignerEditPart( )
{
    if ( !UIUtil.isReportEditorActivated( ) )
    {
        IContextService contextService = (IContextService) PlatformUI.getWorkbench( )
                .getService( IContextService.class );
        if ( contextActivation != null )
        {
            contextService.deactivateContext( contextActivation );
            contextActivation = null;
        }
    }
}
项目:e4macs    文件:SelectionDialog.java   
/**
 * Registers the shell as the same type as its parent with the context
 * support. This ensures that it does not modify the current state of the
 * application.
 */
private final void registerShellType() {
    final Shell shell = getShell();

    final IContextService contextService = (IContextService) editor.getEditorSite().getWorkbenchWindow().getWorkbench().getService(IContextService.class);
    contextService.registerShell(shell, contextService.getShellType((Shell) shell.getParent()));
}
项目:e4macs    文件:EmacsPlusConsoleParticipant.java   
/**
 * @see org.eclipse.ui.console.IConsolePageParticipant#deactivated()
 */
public void deactivated() {
       if (fContextActivation != null){
        IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
        contextService.deactivateContext(fContextActivation);
        fContextActivation = null;
        ((EmacsPlusConsole)console).offLine();
       }
}
项目:e4macs    文件:CommandSupport.java   
public void getContexts(ITextEditor editor) {
    IContextService contextService = (IContextService) editor.getSite().getService(IContextService.class);
    @SuppressWarnings("unchecked")  // Eclipse documents the collection type
    Collection<String> col = contextService.getActiveContextIds();
    Iterator<String> it = col.iterator();
    while (it.hasNext()) {
        System.out.println("context: " + it.next());        //$NON-NLS-1$
    }
}
项目:e4macs    文件:RepeatCommandSupport.java   
private void clearContext() {
    if (this.repeatc != null) {
        ((IContextService)PlatformUI.getWorkbench().getService(IContextService.class)).deactivateContext(repeatc);
        this.repeatc = null;
    }

}
项目:Pydev    文件:KeyAssistDialog.java   
/**
 * Registers the shell as the same type as its parent with the context
 * support. This ensures that it does not modify the current state of the
 * application.
 */
private final void registerShellType() {
    final Shell shell = getShell();
    final IContextService contextService = (IContextService) EditorUtils.getActiveWorkbenchWindow().getService(
            IContextService.class);
    contextService.registerShell(shell, contextService.getShellType((Shell) shell.getParent()));
}
项目:NIEM-Modeling-Tool    文件:Activator.java   
@Override
public void start(final BundleContext context) throws Exception {
    super.start(context);

    UMLDiagramEditorPlugin.getInstance().setElementInitializers(new ElementInitializers());

    // TODO: remove this in Luna
    final IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(
            IContextService.class);
    contextService.activateContext(NIEM_UML_PAPYRUS_EDITORS_CONTEXT);
}
项目:eclipse-batch-editor    文件:BatchEditor.java   
private void activateBatchEditorContext() {
    IContextService contextService = getSite().getService(IContextService.class);
    if (contextService != null) {
        contextService.activateContext(EDITOR_CONTEXT_MENU_ID);
    }
}
项目:eclipse-bash-editor    文件:BashEditor.java   
private void activateBashEditorContext() {
    IContextService contextService = getSite().getService(IContextService.class);
    if (contextService != null) {
        contextService.activateContext(EDITOR_CONTEXT_MENU_ID);
    }
}
项目:egradle    文件:AbstractGroovyBasedEditor.java   
private void activateEditorContext() {
    IContextService contextService = getSite().getService(IContextService.class);
    if (contextService != null) {
        contextService.activateContext(getEditorInstanceContextId());
    }
}
项目:Notepad4e    文件:NotepadView.java   
/**
 * Allows to create the viewer and initialise it.
 */
@Override
public void createPartControl(Composite parent) {
    preferences = InstanceScope.INSTANCE.getNode(Notepad4e.PLUGIN_ID);
    // Listen to any change to the preferences of the plugin.
    preferences.addPreferenceChangeListener(this);

    clipboard = new Clipboard(Display.getCurrent());

    tabFolder = new CTabFolder(parent, SWT.MULTI | SWT.WRAP);

    addPluginDisposeListener();
    addCloseTabListener();
    addSwapTabListener();
    addRenameTabListener();
    addTabSelectionListener();

    restoreViewFromPreviousSession();

    Job autosaveJob = new Job("ScheduledAutosave") {
        @Override
        protected IStatus run(IProgressMonitor monitor) {
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    savePluginState();
                }
            });
            schedule(SAVE_INTERVAL_MILLIS);
            return Status.OK_STATUS;
        }
    };
    autosaveJob.schedule(SAVE_INTERVAL_MILLIS);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(tabFolder, "Notepad4e.viewer");

    IContextService contextService = getSite().getService(IContextService.class);
    contextService.activateContext("notepad4e.context");

    IHandlerService handlerService = getSite().getService(IHandlerService.class);
    // Associate each shortcut command with the shortcut handler.
    for (NotepadAction notepadAction : NotepadAction.values()) {
        if (notepadAction.getCommandID() != null) {
            handlerService.activateHandler(notepadAction.getCommandID(), shortcutHandler);
        }
    }

    makeActions();
    contributeToActionBars();
}
项目:hssd    文件:HSSDEditor.java   
protected void createPage0() {
    Composite composite = new Composite(getContainer(), SWT.NONE);

    final Layout layout = new FillLayout();
    composite.setLayout(layout);

    keyViewer = new TreeViewer(composite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);

    keyViewer.setContentProvider(new EntryTreeCP());

    keyViewer.setLabelProvider(
            wrapLabelProvider(new EntryTreeLP()));

    keyViewer.setComparator(new ViewerComparator());

    try {
        keyViewer.setInput(getEditorInput());
    }
    catch(VersionError e) {
        keyViewer.setInput(null);

        final Shell shell = getSite().getShell();
        final String title = "Version Error";
        final S msg = new S();
        msg.addf("This HSSD editor supports resource version up to '%s', ",
                e.supportedVersion());
        msg.addf("but the resource reports version '%s'.%n%n",
                e.actualVersion());
        msg.addf("You probably need to upgrade your HSSD editor!");
        MessageDialog.openError(shell, title, msg.toString());
    }

    // Create the help context id for the keyViewer's control
    // PlatformUI.getWorkbench().getHelpSystem().setHelp(keyViewer.getControl(), "com.insweat.hssd.editor.viewer");
    hookContextMenu();
    makeActions();
    hookDoubleClickAction();
    hookDragAndDrop();
    // contributeToActionBars();

    int index = addPage(composite);
    setPageText(index, "EntryTree");

    getSite().setSelectionProvider(keyViewer);

    keyViewer.getTree().addSelectionListener(new EditorSelectionSP(
            this,
            keyViewer,
            HSSDEditorSourceProvider.VAR_HSSD_SELECTION));

    IContextService svc = 
            (IContextService)getSite().getService(IContextService.class);

    svc.activateContext("com.insweat.hssd.editor.contexts.inHSSDEditor");
}
项目: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);
}