本文整理匯總了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;
}