Skip to main content



      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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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
Eclipse UserFriend
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: Mon Jul 07 07:05:12 EDT 2025

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

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

Back to the top