Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How can I get a Shell from inside a handler(SWT RCP Eclipse Wizard)
How can I get a Shell from inside a handler [message #906537] Sat, 01 September 2012 19:58 Go to next message
Jim Jones is currently offline Jim JonesFriend
Messages: 6
Registered: September 2012
Junior Member
I want to open a WizardDialog from a Handler.
So I am doing this and it works:

public void execute(){  
	WizardDialog dlg = new WizardDialog(new Shell() , new MyWizard());  
	if( == Window.OK){			  

But should I be doing new Shell()? I don't know since I am newbie in RCP/SWT.
I thought to use the current Shell so I did:

WizardDialog dlg = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), new MyWizard());

But I got exception:
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Workbench has not been created yet.

Note that my main window is open and I press the menuitem button and from its handler I try to open the WizardDialog. How is it possible that the Workbench is not initialized at this point? I see the window!
Could you please help me out?

[Updated on: Sat, 01 September 2012 20:09]

Report message to a moderator

Re: How can I get a Shell from inside a handler [message #962154 is a reply to message #906537] Sun, 28 October 2012 22:43 Go to previous message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1051
Registered: July 2009
Senior Member

public void execute(Shell shell){
WizardDialog dlg = new WizardDialog(shell , new MyWizard());
if( == Window.OK){
Previous Topic:RCP product export customized ANT script for multiplatform
Next Topic:Unhandled event loop exception when i create javaScript file in My RCP
Goto Forum:

Current Time: Sat May 26 19:57:16 GMT 2018

Powered by FUDForum. Page generated in 0.03041 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top