I tracked down the problem to WindowBuilder seemingly unable to parse its own code.
I created a DetailPage [new->Other...->Window Builder->SWT Designer->Forms->DetailsPage]
The generated code is as follows:
- Code: Select all
package it.condarelli.wbtest.editors;
import org.eclipse.jface.viewers.ISelection;
public class TestDetailPage implements IDetailsPage {
private IManagedForm managedForm;
/**
* Create the details page.
*/
public TestDetailPage() {
// Create the details page
}
/**
* Initialize the details page.
* @param form
*/
public void initialize(IManagedForm form) {
managedForm = form;
}
/**
* Create contents of the details page.
* @param parent
*/
public void createContents(Composite parent) {
FormToolkit toolkit = managedForm.getToolkit();
parent.setLayout(new FillLayout());
//
Section section = toolkit.createSection(parent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
section.setText("Empty Section");
//
Composite composite = toolkit.createComposite(section, SWT.NONE);
toolkit.paintBordersFor(composite);
section.setClient(composite);
}
public void dispose() {
// Dispose
}
public void setFocus() {
// Set focus
}
private void update() {
// Update
}
public boolean setFormInput(Object input) {
return false;
}
public void selectionChanged(IFormPart part, ISelection selection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
update();
}
public void commit(boolean onSave) {
// Commit
}
public boolean isDirty() {
return false;
}
public boolean isStale() {
return false;
}
public void refresh() {
update();
}
}
Unfortunately, when i switch to Design view I see what is in "First Image".
You can see there is absolutely nothing. Section and Composite have vanished.
If I add my own Section the result is shown in "Second Image".
This seems correct, but the generated code is:
- Code: Select all
/**
* Create contents of the details page.
* @param parent
*/
public void createContents(Composite parent) {
FormToolkit toolkit = managedForm.getToolkit();
parent.setLayout(new FillLayout());
//
Section section = toolkit.createSection(parent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
Section section_1 = toolkit.createSection(parent, Section.TWISTIE | Section.TITLE_BAR);
toolkit.paintBordersFor(section_1);
section_1.setText("New Section");
section.setText("Empty Section");
//
Composite composite = toolkit.createComposite(section, SWT.NONE);
toolkit.paintBordersFor(composite);
section.setClient(composite);
}
Before I realized this misbehavior I was happily adding controls to my frame then, of a sudden I was back to the first image.
I began again a couple of times before I convinced myself I didn't goof somewhere.
One of the more complex (??) things I managed to do before going blank again is as follows:
- Code: Select all
/**
* Create contents of the details page.
* @param parent
*/
public void createContents(Composite parent) {
FormToolkit toolkit = managedForm.getToolkit();
//
Section section = toolkit.createSection(parent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
parent.setLayout(new GridLayout(1, false));
Section sctnOverview = toolkit.createSection(parent, Section.TWISTIE | Section.TITLE_BAR);
toolkit.paintBordersFor(sctnOverview);
sctnOverview.setText("Overview");
Composite composite_1 = toolkit.createComposite(sctnOverview, SWT.NONE);
toolkit.paintBordersFor(composite_1);
sctnOverview.setClient(composite_1);
composite_1.setLayout(new GridLayout(2, false));
Label lblTitle = toolkit.createLabel(composite_1, "Title:", SWT.NONE);
lblTitle.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
txtTitle = toolkit.createText(composite_1, "New Text", SWT.NONE);
txtTitle.setText("Title");
txtTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtDesc = toolkit.createText(composite_1, "New Text", SWT.NONE);
txtDesc.setText("Desc");
txtDesc.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label lblWords = toolkit.createLabel(composite_1, "Words:", SWT.NONE);
lblWords.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
txtWordcount = toolkit.createText(composite_1, "New Text", SWT.NONE);
txtWordcount.setText("word count");
txtWordcount.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
sctnOverview.setExpanded(true);
Section sctnChapters = toolkit.createSection(parent, Section.TWISTIE | Section.TITLE_BAR);
toolkit.paintBordersFor(sctnChapters);
sctnChapters.setText("Chapters");
table = toolkit.createTable(sctnChapters, SWT.NONE);
toolkit.paintBordersFor(table);
sctnChapters.setClient(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
sctnChapters.setExpanded(true);
section.setText("Empty Section");
//
Composite composite = toolkit.createComposite(section, SWT.NONE);
toolkit.paintBordersFor(composite);
section.setClient(composite);
}
Evaluation of this product is not really satisfying to date
It seems to have all features I need, but, if they do not work....
Am I doing something seriously wrong?
Please advise.
Best Regards
Mauro