Java Code Examples for org.eclipse.ui.IWorkbenchPartSite#getShell()

The following examples show how to use org.eclipse.ui.IWorkbenchPartSite#getShell() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightingReconciler.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: FixedHighlightingReconciler.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: SemanticHighlightingReconciler.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Update the presentation.
 *
 * @param textPresentation the text presentation
 * @param addedPositions the added positions
 * @param removedPositions the removed positions
 */
private void updatePresentation(TextPresentation textPresentation, List<Position> addedPositions, List<Position> removedPositions) {
	Runnable runnable= fJobPresenter.createUpdateRunnable(textPresentation, addedPositions, removedPositions);
	if (runnable == null)
		return;

	JavaEditor editor= fEditor;
	if (editor == null)
		return;

	IWorkbenchPartSite site= editor.getSite();
	if (site == null)
		return;

	Shell shell= site.getShell();
	if (shell == null || shell.isDisposed())
		return;

	Display display= shell.getDisplay();
	if (display == null || display.isDisposed())
		return;

	display.asyncExec(runnable);
}
 
Example 4
Source File: ImportsAwareClipboardAction.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: WorkbenchUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public static Shell getActivePartShell() {
      IWorkbenchPage activePage = WorkbenchUtils.getActivePage();
      if (activePage == null) {
      	return null;
      }
IWorkbenchPart activePart = activePage.getActivePart();
if (activePart == null) {
      	return null;
      }
IWorkbenchPartSite site = activePart.getSite();
if (site == null) {
      	return null;
      }
return site.getShell();
  }
 
Example 6
Source File: ClipboardOperationAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: SourceEditor.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
public void format() {
    Display display = null;
    IWorkbenchPartSite site = getSite();
    Shell shell = site.getShell();
    if (shell != null && !shell.isDisposed())
        display = shell.getDisplay();
    BusyIndicator.showWhile(display, new Runnable() {
        public void run() {
            doFormat();
        }
    });
}
 
Example 8
Source File: JarPackageActionDelegate.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
	IWorkbenchPartSite site= targetPart.getSite();
	fShell= site != null ? site.getShell() : null;
}