org.eclipse.ui.IWorkbenchPartSite#getShell ( )源码实例Demo

下面列出了org.eclipse.ui.IWorkbenchPartSite#getShell ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: xtext-eclipse   文件: HighlightingReconciler.java
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;
}
 
源代码2 项目: dsl-devkit   文件: FixedHighlightingReconciler.java
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;
}
 
/**
 * 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);
}
 
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;
}
 
源代码5 项目: xds-ide   文件: WorkbenchUtils.java
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();
  }
 
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;
}
 
源代码7 项目: textuml   文件: SourceEditor.java
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();
        }
    });
}
 
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
	IWorkbenchPartSite site= targetPart.getSite();
	fShell= site != null ? site.getShell() : null;
}