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 15:58 Go to next message
Jim Jones is currently offline Jim Jones
Messages: 6
Registered: September 2012
Junior Member
I want to open a WizardDialog from a Handler.
So I am doing this and it works:

@Execute   
public void execute(){  
	System.out.println("Called");  
	WizardDialog dlg = new WizardDialog(new Shell() , new MyWizard());  
	if(dlg.open() == 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:
Quote:
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 16: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 18:43 Go to previous message
Lars Vogel is currently offline Lars Vogel
Messages: 1049
Registered: July 2009
Senior Member

@Execute
public void execute(Shell shell){
System.out.println("Called");
WizardDialog dlg = new WizardDialog(shell , new MyWizard());
if(dlg.open() == 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: Wed Aug 27 15:25:36 EDT 2014

Powered by FUDForum. Page generated in 0.02115 seconds