use of org.eclipse.ui.IWorkbenchPartSite in project ecf by eclipse.
the class EditorCompoundContributionItem method getSelection.
protected ITextSelection getSelection() {
final IEditorPart ep = getEditorPart();
if (ep == null)
return null;
final IWorkbenchPartSite ws = ep.getEditorSite();
if (ws == null)
return null;
final ISelectionProvider sp = ws.getSelectionProvider();
if (sp == null)
return null;
final ISelection sel = sp.getSelection();
if (sel == null || !(sel instanceof ITextSelection))
return null;
return (ITextSelection) sel;
}
use of org.eclipse.ui.IWorkbenchPartSite in project statecharts by Yakindu.
the class XtextStyledTextCellEditor method initContextMenu.
protected void initContextMenu(Control control) {
MenuManager menuManager = createMenuManager();
Menu contextMenu = menuManager.createContextMenu(control);
control.setMenu(contextMenu);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPartSite site = window.getActivePage().getActiveEditor().getSite();
site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider());
}
use of org.eclipse.ui.IWorkbenchPartSite in project statecharts by Yakindu.
the class AbstractEditorPropertySection method initContextMenu.
protected void initContextMenu(Control control) {
MenuManager menuManager = new FilteringMenuManager();
Menu contextMenu = menuManager.createContextMenu(control);
control.setMenu(contextMenu);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPartSite site = window.getActivePage().getActiveEditor().getSite();
site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider());
}
Aggregations