I'm trying to produce a wizard using the Wizard
class (org.eclipse.jface.wizard.Wizard)
Basically where I extend the Wizard
in the constructor I addPage
the two pages I want.
On my first page I take some credentials.
On the second page I want to run a query against the database using the credentials from the first page to populate a table with names.
How do I go about passing these values from the first to the second page?
To all intents and purposes my code at present is the same as http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/Asurveyusingawizard.htm except I obtain some strings from some text boxes on the first page and have a table on the second page.
I have read about containers and see there is a setData() method, is this something I can utilize?
I like to create my data object in the Wizard and pass it into the constructor of each of my WizardPages. For example:
public void addPages() {
data = new MyData()
addPage(new FirstPage(data));
addPage(new SecondPage(data));
...
}
One advantage to this approach is you have access to your data object during your wizard's performFinish.