当前位置: 首页>>代码示例>>Java>>正文


Java IWorkbenchPartSite.getShell方法代码示例

本文整理汇总了Java中org.eclipse.ui.IWorkbenchPartSite.getShell方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchPartSite.getShell方法的具体用法?Java IWorkbenchPartSite.getShell怎么用?Java IWorkbenchPartSite.getShell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.IWorkbenchPartSite的用法示例。


在下文中一共展示了IWorkbenchPartSite.getShell方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDisplay

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
private Display getDisplay() {
  XtextEditor editor = this.editor;
  if (editor == null) {
    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;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:23,代码来源:FixedHighlightingReconciler.java

示例2: getDisplay

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
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;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:HighlightingReconciler.java

示例3: updatePresentation

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:SemanticHighlightingReconciler.java

示例4: exportToFile

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * Exports the brute text in the current note as a text file.
 * 
 * @param iWorkbenchPartSite
 */
public void exportToFile(IWorkbenchPartSite iWorkbenchPartSite) {
	// Retrieve the file to save to with an explorer window.
	FileDialog fileDialog = new FileDialog(iWorkbenchPartSite.getShell(), SWT.SAVE);
	fileDialog.setText(LocalStrings.dialogExportTitle);
	String fileName = fileDialog.open();
	// Invalid name specified.
	if (fileName == null || fileName.isEmpty()) {
		return;
	}

	File file = new File(fileName);
	if (file.exists() && !MessageDialog.openQuestion(iWorkbenchPartSite.getShell(),
			LocalStrings.dialogOverwriteTitle, LocalStrings.dialogOverwriteMsg)) {
		return;
	}

	// Write the current note's text to the file, with handling of IO exceptions.
	try (FileOutputStream outStream = new FileOutputStream(file);
			PrintWriter printStream = new PrintWriter(outStream)) {
		printStream.print(getText());
		printStream.flush();
		MessageDialog.openInformation(iWorkbenchPartSite.getShell(), LocalStrings.dialogExportedTitle,
				LocalStrings.dialogExportedMsg);
	} catch (IOException e) {
		MessageDialog.openInformation(iWorkbenchPartSite.getShell(), LocalStrings.dialogErrorTitle,
				LocalStrings.dialogErrorMsg);
		Notepad4e.getDefault().getLog().log(new Status(IStatus.ERROR, LocalStrings.dialogErrorMsg, e.toString()));
	}
}
 
开发者ID:PyvesB,项目名称:Notepad4e,代码行数:35,代码来源:Note.java

示例5: getShell

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:ClipboardOperationAction.java

示例6: format

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
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();
        }
    });
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:13,代码来源:SourceEditor.java

示例7: ContextMenuSupport

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/** Create SWT context menu
 *  @param site RCP site
 *  @param parent Parent SWT widget
 *  @param representation Representation
 */
public ContextMenuSupport(final RuntimeViewPart view, final Control parent, final RCP_JFXRepresentation representation)
{
    this.view = view;
    final IWorkbenchPartSite site = view.getSite();
    shell = site.getShell();

    // Tried to use a JFX context menu on the individual items,
    // but adding the existing PV contributions requires parsing
    // the registry and creating suitable JFX menu entries.
    // Finally, it was unclear how to set the "activeMenuSelection"
    // required by existing object contributions.
    //
    // So using SWT context menu, automatically populated with PV contributions.

    // Selection provider to inform RCP about PV for the context menu
    final ISelectionProvider sel_provider = new RCPSelectionProvider();
    site.setSelectionProvider(sel_provider);

    // RCP context menu w/ "additions" placeholder for contributions
    final MenuManager mm = new MenuManager();
    mm.setRemoveAllWhenShown(true);
    mm.addMenuListener(manager -> fillContextMenu(manager));
    site.registerContextMenu(mm, sel_provider);

    // Create menu ..
    final Menu menu = mm.createContextMenu(parent);
    // .. but _don't_ attach to SWT control
    //     parent.setMenu(menu);

    // Menu is shown by representation listener _after_
    // setting the selection to widget's PV
    final ToolkitListener tkl = new ToolkitListener()
    {
        @Override
        public void handleContextMenu(final Widget widget)
        {
            IStructuredSelection sel = StructuredSelection.EMPTY;
            final Optional<WidgetProperty<String>> name_prop = widget.checkProperty(propPVName);
            if (name_prop.isPresent())
            {
                final String pv_name = name_prop.get().getValue();
                if (!pv_name.isEmpty())
                    sel = new StructuredSelection(new ProcessVariable(pv_name));
            }
            sel_provider.setSelection(sel);

            // Show the menu
            view.setActiveWidget(widget);
            menu.setVisible(true);
        }
    };
    representation.addListener(tkl);
    parent.addDisposeListener(event -> representation.removeListener(tkl));
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:60,代码来源:ContextMenuSupport.java

示例8: setActivePart

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
	IWorkbenchPartSite site= targetPart.getSite();
	fShell= site != null ? site.getShell() : null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:JarPackageActionDelegate.java


注:本文中的org.eclipse.ui.IWorkbenchPartSite.getShell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。