Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Getting the Selection from NEW wizard in Eclipse(Getting the previously selected item in your Wizard class)
Getting the Selection from NEW wizard in Eclipse [message #641140] Wed, 24 November 2010 07:03 Go to next message
Anurag is currently offline Anurag
Messages: 2
Registered: November 2010
Location: Bangalore, India
Junior Member
Hi Guys,

I have added a new Wizard entry in my plugin.xml which goes like this

 <wizard
            name="Workflow"
            icon="icons/bpd.gif"
            category="com.***.bpdesigner"
            class="com.***.bpdesigner.BPCreationWizard"
            id="com.***.bpdesigner.WorkflowCreationWizard">
         <description>
            Creates a workflow
         </description>
         <selection
               class="org.eclipse.core.resources.IResource">
         </selection>
      </wizard>


What I want to do is to somehow check in BPCreationWizard.java (the configured class, which is instantiated by the new wizard) which FILE TYPE was chosen from the new Wizard dialog.

We are using "BPCreationWizard" as the class name for two different file types viz. Microflow and Workflow.

The only way forward as of now is to extend another class from BPCreationWizard which will set a flag saying that it is a workflow and mention this class in Workflow configuration in plugin.xml .. but having a new class which delegates most of the work to the base class does not sound good.

Is there any way by which I can figure out in MY WIzard class as to which OBJECT was selected in the NEW wizard??

When I click next my configured class is instantiated. So in the constructor of "BPCreationWizard" I want to somehow see which item was selected from the NEW wizard.

I am a newbie on plugin development; any help would be appreciated.

Thanks,
Ragz



[Updated on: Wed, 24 November 2010 11:26]

Report message to a moderator

Re: Getting the Selection from NEW wizard in Eclipse [message #641161 is a reply to message #641140] Wed, 24 November 2010 08:13 Go to previous messageGo to next message
Anurag is currently offline Anurag
Messages: 2
Registered: November 2010
Location: Bangalore, India
Junior Member
Okay now this works out for me Smile

But I am sure there must be a better way if at all .. any help appreciated thanks.

	try{
		Object data = PlatformUI.getWorkbench().getDisplay().getActiveShell().getData();
		if(data instanceof WizardDialog){
			WizardDialog dialog = (WizardDialog)PlatformUI.getWorkbench().getDisplay().getActiveShell().getData();
			String description = dialog.getCurrentPage().getDescription();
			
			if(description != null && description.toUpperCase().contains("WORKFLOW")){
				this.workflow = true;
			}
		}
		}catch(NullPointerException e){
			//DO nothing
		}

Re: Getting the Selection from NEW wizard in Eclipse [message #641364 is a reply to message #641140] Thu, 25 November 2010 03:17 Go to previous message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 24/11/10 5:33 PM, Anurag wrote:
> Hi Guys,
>
> I have added a new Wizard entry in my plugin.xml which goes like this
>
> <wizard
> name="Workflow"
> icon="icons/bpd.gif"
> category="com.***.bpdesigner"
> class="com.***.bpdesigner.BPCreationWizard"
> id="com.***.bpdesigner.WorkflowCreationWizard">
> <description>
> Creates a workflow
> </description>
> <selection
> class="org.eclipse.core.resources.IResource">
> </selection>
> </wizard>
>
> What I want to do is to somehow check in BPCreationWizard.java (the
> configured class, which is instantiated by the new wizard) which FILE
> TYPE was chosen from the new Wizard dialog.
>
> We are using "BPCreationWizard" as the class name for two different file
> types viz. Microflow and Workflow.
>
> The only way forward as of now is to extend another class from
> BPCreationWizard which will set a flag saying that it is a workflow and
> mention this class in Workflow configuration in plugin.xml .. but having
> a new class which delegates most of the work to the base class does not
> sound good.
>
> Is there any way by which I can figure out in MY WIzard class as to
> which OBJECT was selected in the NEW wizard??
>
> As I have selected Work Flow in the picture below:
>
>
> When I click next my configured class is instantiated. So in the
> constructor of "BPCreationWizard" I want to somehow see which item was
> selected from the NEW wizard.
>
> I am a newbie on plugin development; any help would be appreciated.

You wizard could implement IExecutableExtension and then pass on the
type from the plugin.xml.

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:Product Export creates source for plugin with generateSourceBundle=false
Next Topic:Producing a group archive with p2.gathering=true
Goto Forum:
  


Current Time: Thu Jul 31 03:39:47 EDT 2014

Powered by FUDForum. Page generated in 0.02188 seconds