本文整理汇总了Java中org.eclipse.ui.IWorkbenchWindow.getShell方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchWindow.getShell方法的具体用法?Java IWorkbenchWindow.getShell怎么用?Java IWorkbenchWindow.getShell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.IWorkbenchWindow
的用法示例。
在下文中一共展示了IWorkbenchWindow.getShell方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
final Display display = Display.getDefault();
final Shell shell = window.getShell();
Locale.setDefault(Locale.ENGLISH);
final TipDayEx tipDayEx = new TipDayEx();
for (String tipMessage : new String[] { "This is the first tip",
"This is the second tip", "This is the third tip",
"This is the forth tip", "This is the fifth tip" }) {
tipDayEx.addTip(String.format(
"<h4>%s</h4>" + "<b>%s</b> " + "<u>%s</u> " + "<i>%s</i> " + "%s "
+ "%s<br/>" + "<p color=\"#A00000\">%s</p>",
tipMessage, tipMessage, tipMessage, tipMessage, tipMessage,
tipMessage, tipMessage));
}
tipDayEx.open(shell, display);
return null;
}
示例2: execute
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
final INewWizard wizard = new NewModelWizard();
// Initialize the selection
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final ISelectionService service = window.getSelectionService();
final IStructuredSelection selection = (IStructuredSelection)service
.getSelection("org.eclipse.sirius.ui.tools.views.model.explorer"); //$NON-NLS-1$
wizard.init(PlatformUI.getWorkbench(), selection);
// Open the new model wizard
final WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
dialog.open();
return null;
}
示例3: getActiveWorkbenchWindowShell
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
* Returns the active workbench window shell.
* @return the active workbench window shell
*/
public Shell getActiveWorkbenchWindowShell() {
IWorkbenchWindow iwbWindow = this.getActiveWorkbenchWindow();
if (iwbWindow!=null) {
return iwbWindow.getShell();
}
return null;
}
示例4: getActiveWorkbenchShell
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
* Returns active workbench shell - or <code>null</code>
*
* @return active workbench shell - or <code>null</code>
*/
public static Shell getActiveWorkbenchShell() {
IWorkbench workbench = getWorkbench();
if (workbench == null) {
return null;
}
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window == null) {
return null;
}
Shell shell = window.getShell();
return shell;
}
示例5: windowOpened
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public void windowOpened(IWorkbenchWindow window) {
if (window.getShell() != null) {
IWorkbenchPage[] pages = window.getPages();
for (IWorkbenchPage page : pages) {
pageOpened(page);
}
window.addPageListener(this);
}
}
示例6: resetWorkbench
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
private void resetWorkbench() {
try {
IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (IViewReference iViewReference : views) {
if ( iViewReference.getTitle().equals( "Welcome" ) ) {
iViewReference.getPage().hideView(iViewReference);
break;
}
}
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
Shell activeShell = Display.getCurrent().getActiveShell();
if ( activeShell != null && activeShell != workbenchWindow.getShell() ) {
activeShell.close();
}
page.closeAllEditors( false );
page.resetPerspective();
String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective();
workbench.showPerspective( defaultPerspectiveId, workbenchWindow );
page.resetPerspective();
}
catch ( WorkbenchException e ) {
throw new RuntimeException( e );
}
}
示例7: resetWorkbench
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
private static void resetWorkbench() {
try {
IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getViewReferences();
for (IViewReference iViewReference : views) {
if (iViewReference.getTitle().equals("Welcome")) {
iViewReference.getPage().hideView(iViewReference);
break;
}
}
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
Shell activeShell = Display.getCurrent().getActiveShell();
if (activeShell != null && activeShell != workbenchWindow.getShell()) {
activeShell.close();
}
page.closeAllEditors(false);
page.resetPerspective();
String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective();
workbench.showPerspective(defaultPerspectiveId, workbenchWindow);
page.resetPerspective();
} catch (WorkbenchException e) {
throw new RuntimeException(e);
}
}
示例8: execute
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
TargetHandlerDialog targetHandler = new TargetHandlerDialog(window.getShell());
targetHandler.open();
return null;
}
示例9: execute
import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
ISelection selection = HandlerUtil.getCurrentSelection(event);
POJO2DataTypeWizard wizard = new POJO2DataTypeWizard();
wizard.init(window.getWorkbench(),
selection instanceof IStructuredSelection
? (IStructuredSelection) selection : StructuredSelection.EMPTY);
WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
dialog.open();
return null;
}