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

The following examples show how to use org.eclipse.ui.IWorkbenchPartSite#getShell() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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
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
/**
 * 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
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 Project: xds-ide   File: WorkbenchUtils.java    License: 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
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 Project: textuml   File: SourceEditor.java    License: 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
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
	IWorkbenchPartSite site= targetPart.getSite();
	fShell= site != null ? site.getShell() : null;
}