use of org.eclipse.ui.contexts.IContextService in project titan.EclipsePlug-ins by eclipse.
the class TTCN3Editor 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;
}
use of org.eclipse.ui.contexts.IContextService in project erlide_eclipse by erlang.
the class ErlangOutlinePage method createControl.
@Override
public void createControl(final Composite parent) {
final Tree tree = new Tree(parent, SWT.MULTI);
fOutlineViewer = new TreeViewer(tree);
fOutlineViewer.setAutoExpandLevel(0);
fOutlineViewer.setUseHashlookup(true);
fOutlineViewer.setContentProvider(fEditor.createOutlineContentProvider());
fOutlineViewer.setLabelProvider(fEditor.createOutlineLabelProvider());
fOutlineViewer.addPostSelectionChangedListener(this);
fOutlineViewer.setInput(fModule);
final IPageSite site = getSite();
fOpenAndLinkWithEditorHelper = new OpenAndLinkWithEditorHelper(fOutlineViewer, fEditor, site.getPage());
final IContextService service = site.getService(IContextService.class);
if (service != null) {
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
}
final MenuManager manager = new MenuManager();
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(this::contextMenuAboutToShow);
final Menu menu = manager.createContextMenu(tree);
tree.setMenu(menu);
site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager, fOutlineViewer);
fActionGroups = new CompositeActionGroup(new ActionGroup[] { new ErlangSearchActionGroup(this) });
// register global actions
final IActionBars actionBars = site.getActionBars();
actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, fEditor.getAction(ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, fEditor.getAction(ITextEditorActionConstants.REDO));
fActionGroups.fillActionBars(actionBars);
registerToolbarActions(actionBars);
final IHandlerService handlerService = site.getService(IHandlerService.class);
if (handlerService != null) {
handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
}
fPartListener = new IPartListener() {
@Override
public void partOpened(final IWorkbenchPart part) {
// JC borde filter-metoden ovan r�cka?
addFilters();
}
@Override
public void partDeactivated(final IWorkbenchPart part) {
}
@Override
public void partClosed(final IWorkbenchPart part) {
}
@Override
public void partBroughtToTop(final IWorkbenchPart part) {
}
@Override
public void partActivated(final IWorkbenchPart part) {
addFilters();
}
};
getSite().getPage().addPartListener(fPartListener);
}
use of org.eclipse.ui.contexts.IContextService in project erlide_eclipse by erlang.
the class ConsolePageParticipant method activated.
@Override
public void activated() {
// add EOF submissions
final IPageSite site = fPage.getSite();
final IHandlerService handlerService = site.getService(IHandlerService.class);
final IContextService contextService = site.getService(IContextService.class);
if (handlerService == null || contextService == null) {
return;
}
fActivatedContext = contextService.activateContext(ConsolePageParticipant.fContextId);
fActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", // $NON-NLS-1$
fEOFHandler);
}
use of org.eclipse.ui.contexts.IContextService in project erlide_eclipse by erlang.
the class ConsolePageParticipant method deactivated.
@Override
public void deactivated() {
// remove EOF submissions
final IPageSite site = fPage.getSite();
final IHandlerService handlerService = site.getService(IHandlerService.class);
final IContextService contextService = site.getService(IContextService.class);
if (handlerService == null || contextService == null) {
return;
}
handlerService.deactivateHandler(fActivatedHandler);
contextService.deactivateContext(fActivatedContext);
}
Aggregations