Search in sources :

Example 6 with IContextService

use of org.eclipse.ui.contexts.IContextService in project n4js by eclipse.

the class N4IDEXpectView method activateContext.

/**
 * 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);
}
Also used : IContextService(org.eclipse.ui.contexts.IContextService)

Example 7 with IContextService

use of org.eclipse.ui.contexts.IContextService in project tdq-studio-se by Talend.

the class PatternTestView method activateContext.

/**
 * 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 = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext(VIEW_CONTEXT_ID);
    TestRegularAction testRegularAction = new TestRegularAction();
    IHandlerService service = (IHandlerService) getViewSite().getService(IHandlerService.class);
    service.activateHandler(testRegularAction.getActionDefinitionId(), new ActionHandler(testRegularAction));
}
Also used : IHandlerService(org.eclipse.ui.handlers.IHandlerService) IContextService(org.eclipse.ui.contexts.IContextService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 8 with IContextService

use of org.eclipse.ui.contexts.IContextService in project titan.EclipsePlug-ins by eclipse.

the class ASN1Editor method createSourceViewer.

@Override
protected ISourceViewer createSourceViewer(final Composite parent, final IVerticalRuler ruler, final int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
    getSourceViewerDecorationSupport(viewer);
    Activator.getDefault().getPreferenceStore().addPropertyChangeListener(foldingListener);
    // Context setting is placed here because getEditorSite() must
    // be called after the editor is initialized.
    IContextService contextService = (IContextService) getEditorSite().getService(IContextService.class);
    // As the service is retrieved from the editor instance it will
    // be active only within the editor.
    contextService.activateContext(EDITOR_SCOPE);
    return viewer;
}
Also used : IContextService(org.eclipse.ui.contexts.IContextService) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer)

Example 9 with IContextService

use of org.eclipse.ui.contexts.IContextService in project titan.EclipsePlug-ins by eclipse.

the class ConfigTextEditor method createSourceViewer.

@Override
protected ISourceViewer createSourceViewer(final Composite parent, final IVerticalRuler ruler, final int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
    getSourceViewerDecorationSupport(viewer);
    Activator.getDefault().getPreferenceStore().addPropertyChangeListener(foldingListener);
    // Context setting is placed here because getEditorSite() must
    // be called after the editor is
    // initialized.
    IContextService contextService = (IContextService) getEditorSite().getService(IContextService.class);
    // As the service is retrieved from the editor instance it will
    // be active only within the editor.
    contextService.activateContext(EDITOR_SCOPE);
    return viewer;
}
Also used : IContextService(org.eclipse.ui.contexts.IContextService) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer)

Example 10 with IContextService

use of org.eclipse.ui.contexts.IContextService in project titan.EclipsePlug-ins by eclipse.

the class GraphEditor method init.

/**
 * We just store the input and site to catch events
 *
 * @param input
 *            : the input to set
 * @param site
 *            : the site to set
 */
@Override
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
    final IContextService contextService = (IContextService) site.getService(IContextService.class);
    contextService.activateContext(GRAPH_CONTEXT_ID);
    handlerService = (IHandlerService) site.getService(IHandlerService.class);
    setSite(site);
    setInput(input);
}
Also used : IContextService(org.eclipse.ui.contexts.IContextService)

Aggregations

IContextService (org.eclipse.ui.contexts.IContextService)39 IContextActivation (org.eclipse.ui.contexts.IContextActivation)8 IHandlerService (org.eclipse.ui.handlers.IHandlerService)8 FocusEvent (org.eclipse.swt.events.FocusEvent)7 FocusListener (org.eclipse.swt.events.FocusListener)7 SQLEditorBase (org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase)6 INavigatorModelView (org.jkiss.dbeaver.ui.navigator.INavigatorModelView)6 ActionHandler (org.eclipse.jface.commands.ActionHandler)5 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)5 ProjectionViewer (org.eclipse.jface.text.source.projection.ProjectionViewer)4 DBSDataContainer (org.jkiss.dbeaver.model.struct.DBSDataContainer)4 ResultSetViewer (org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer)4 EntityEditor (org.jkiss.dbeaver.ui.editors.entity.EntityEditor)4 SQLEditor (org.jkiss.dbeaver.ui.editors.sql.SQLEditor)4 IAction (org.eclipse.jface.action.IAction)3 Shell (org.eclipse.swt.widgets.Shell)3 IPageSite (org.eclipse.ui.part.IPageSite)3 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IExecutionListener (org.eclipse.core.commands.IExecutionListener)2