I have a Wizard with two pages: pageone extending WizardNewProjectCreationPage, and pagetwo is extending WizardPage. I want the user to be able to create the project first, and then add files to the project on the second page.
For the latter I want to use a SWT Table (?) like when you pick an interface in the Java Class Wizard in Eclipse IDE (cf. picture here). Also the “Add” button next to it.
How can I achieve this? Do I have to use Eclipse Forms API for this? Or simply add a SWT Table? I have used the Plug-In Spy but the source code given in NewClassWizardPage and NewTypeWizardPage seems to be very specific to this example and I cannot make sense of it.
I’ve also had a look at vogella’s tutorial for JFace table, but I can’t get my head around it.
Just some basic steps would be great, or maybe somebody has done this before?
I can easily understand why you’re confused… there are indeed many ways to do this. You even left out Data Binding which provides you with yet another way to populate and decorate the table in question.
To sum up the usage of the different APIs:
TableVieweron top ofTable. These viewers provides a high-level interface to the functionality of the underlying control – e.g. with models, label providers, sorting, filtering and more. (The viewers can easily be compared with the Swing counterparts…)So… you have to decide on whether to use the model facet of JFace and Data Binding, but the rest of the APIs are often combined in the same view or dialog.
NewClassWizardPageandNewTypeWizardPageare both particular complicated examples of wizards – don’t base your own work on these!For your particular case – as I understand it – I would use a simple JFace
TableViewerto hold the list of interfaces… (I use aTableViewerrather than aListVieweras the later cannot have an image as part of the label provider.) The “Add” and “Remove” buttons will manipulate the model of the viewer and then update the viewer. You don’t need Eclipse Forms as the wizards usually don’t look like web pages. And Data Binding is also an overkill here given the very, very simple data for the wizard.Please note that the function of a wizard is only performed after all the wizard pages has been shown and the “Finish” button is pressed.