Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Wizard Page depending on Wizard Page
Wizard Page depending on Wizard Page [message #662365] Wed, 30 March 2011 12:07 Go to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
I want to create a wizard where the second wizard page depends on the selection of the first wizard page.

In my first page I have two radio buttons and depending on the selection another wizard page sholud be opened.
But how can I achieve this that the next page depends on my selection.
Also how do I get the User Input out from my WizardPages?
Re: Wizard Page depending on Wizard Page [message #662368 is a reply to message #662365] Wed, 30 March 2011 12:18 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 2011-03-30 14:07, akoeck@gmx.de wrote:
> I want to create a wizard where the second wizard page depends on the
> selection of the first wizard page.
>
> In my first page I have two radio buttons and depending on the selection
> another wizard page sholud be opened.
> But how can I achieve this that the next page depends on my selection.
> Also how do I get the User Input out from my WizardPages?

Let your WizardPage implement IPageChangingListener and/or override
setPreviousPage. Which solution is the right one for you, depends on
your exact use-case.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Wizard Page depending on Wizard Page [message #662374 is a reply to message #662368] Wed, 30 March 2011 12:50 Go to previous messageGo to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
Daniel Krügler wrote on Wed, 30 March 2011 08:18
On 2011-03-30 14:07, akoeck@gmx.de wrote:
> I want to create a wizard where the second wizard page depends on the
> selection of the first wizard page.
>
> In my first page I have two radio buttons and depending on the selection
> another wizard page sholud be opened.
> But how can I achieve this that the next page depends on my selection.
> Also how do I get the User Input out from my WizardPages?

Let your WizardPage implement IPageChangingListener and/or override
setPreviousPage. Which solution is the right one for you, depends on
your exact use-case.

HTH & Greetings from Bremen,

Daniel Krügler

So far so good, but I don't really know how I get the information from my radiobuttons. And the use them in the handlePageChanging method.
Re: Wizard Page depending on Wizard Page [message #662383 is a reply to message #662374] Wed, 30 March 2011 13:09 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 2011-03-30 14:50, akoeck@gmx.de wrote:
> Daniel Krügler wrote on Wed, 30 March 2011 08:18
>> On 2011-03-30 14:07, akoeck@gmx.de wrote:
>> > I want to create a wizard where the second wizard page depends on the
>> > selection of the first wizard page.
>> >
>> > In my first page I have two radio buttons and depending on the
>> selection
>> > another wizard page sholud be opened.
>> > But how can I achieve this that the next page depends on my selection.
>> > Also how do I get the User Input out from my WizardPages?
>>
>> Let your WizardPage implement IPageChangingListener and/or override
>> setPreviousPage. Which solution is the right one for you, depends on
>> your exact use-case.
>>
>> HTH & Greetings from Bremen,
>>
>> Daniel Krügler
>
> So far so good, but I don't really know how I get the information from
> my radiobuttons. And the use them in the handlePageChanging method.

Obviously you need to introduce some state shared among these pages. I
typically define an interface ISharedWizardState where a single instance
exists that is shared among all WizardPages of a given dialog. They are
typically constructed with this state. If you participate in some
extension-point based WizardPage construction you probably need to
invent an UI service or a data source (e.g. via org.eclipse.ui.services)
to realize something like this.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Wizard Page depending on Wizard Page [message #662397 is a reply to message #662365] Wed, 30 March 2011 14:36 Go to previous message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
Ok, I got it.

I have added a SelectionListener to my radio buttons. Depending on the selection I set a bool. With the value of the bool I select the next Page in the getNextPage() method.
	/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	public void createControl(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout(1,false);
		composite.setLayout(layout);
		setControl(composite);
		
		Button radio1 = new Button(composite, SWT.RADIO);
		radioNormal.setText("TEXT");
		radioNormal.setSelection(true);
		radioNormal.addSelectionListener(new SelectionAdapter(){
			public void widgetSelected(SelectionEvent event){
				Widget widget = event.widget;
				if(widget instanceof Button){
					Button button = (Button) widget;
					if(button.getSelection()){
						boolval = true;
						otherboolval = false;
					}
				}
			}
		});
		
		Button radio2 = new Button(composite, SWT.RADIO);
		radio2.setText("TEXT)");
		radioSetOperation.addSelectionListener(new SelectionAdapter(){
			public void widgetSelected(SelectionEvent event){
				Widget widget = event.widget;
				if(widget instanceof Button){
					Button button = (Button) widget;
					if(button.getSelection()){
						otherboolval = true;
						boolval = false;
					}
				}
			}
		});
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
	 */
	@Override
	public IWizardPage getNextPage(){
		if(boolval){
			return getWizard().getPage("PageXXX);
		} else if(otherboolval){
			return getWizard().getPage("PageYYY");
		} else {
			return null;
		}
	}	

Previous Topic:read a file from inside the plugin jar.
Next Topic:MenuContribution: How to add a menu item under File.New Menu?
Goto Forum:
  


Current Time: Sat Aug 08 16:08:54 GMT 2020

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

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

Back to the top