use of org.eclipse.ui.IWorkbenchPartSite in project jbosstools-openshift by jbosstools.
the class UIUtils method getCurrentSelection.
/**
* Use this method instead of HandlerUtil.getCurrentSelection(event)
* when action is called on Properties View.
*
* @param event
* @return
*/
public static ISelection getCurrentSelection(ExecutionEvent event) {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
IWorkbenchPartSite site = (part != null) ? part.getSite() : null;
IWorkbenchWindow window = (site != null) ? site.getWorkbenchWindow() : null;
ISelectionService service = (window != null) ? window.getSelectionService() : null;
return service != null ? service.getSelection() : null;
}
use of org.eclipse.ui.IWorkbenchPartSite in project xtext-eclipse by eclipse.
the class HighlightingReconciler method getDisplay.
private Display getDisplay() {
XtextEditor editor = this.editor;
if (editor == null) {
if (sourceViewer != null)
return sourceViewer.getControl().getDisplay();
return null;
}
IWorkbenchPartSite site = editor.getSite();
if (site == null)
return null;
Shell shell = site.getShell();
if (shell == null || shell.isDisposed())
return null;
Display display = shell.getDisplay();
if (display == null || display.isDisposed())
return null;
return display;
}
use of org.eclipse.ui.IWorkbenchPartSite in project xtext-eclipse by eclipse.
the class ImportsAwareClipboardAction method getShell.
private Shell getShell() {
ITextEditor editor = getTextEditor();
if (editor != null) {
IWorkbenchPartSite site = editor.getSite();
Shell shell = site.getShell();
if (shell != null && !shell.isDisposed()) {
return shell;
}
}
return null;
}
use of org.eclipse.ui.IWorkbenchPartSite in project egit by eclipse.
the class GitHistoryPage method getPartSite.
private IWorkbenchPartSite getPartSite() {
final IWorkbenchPart part = getHistoryPageSite().getPart();
IWorkbenchPartSite site = null;
if (part != null)
site = part.getSite();
return site;
}
use of org.eclipse.ui.IWorkbenchPartSite in project statecharts by Yakindu.
the class StatechartDefinitionSection method initContextMenu.
protected void initContextMenu(Control control) {
MenuManager menuManager = new FilteringMenuManager();
Menu contextMenu = menuManager.createContextMenu(control);
control.setMenu(contextMenu);
IWorkbenchPartSite site = editorPart.getSite();
if (site != null)
site.registerContextMenu("org.yakindu.base.xtext.utils.jface.viewers.StyledTextXtextAdapterContextMenu", menuManager, site.getSelectionProvider());
}
Aggregations