本文整理汇总了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;
}
示例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;
}
示例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()));
}
}
示例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;
}
示例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();
}
});
}
示例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));
}
示例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;
}