I'M developing for the first time a MultiPageEditor
, where one page should display a checkboxTreeViewer
, but I don't get it to work. Also the other Page with an example label don't work. Am I doing something completly wrong? Here is my code so far:
public class PlcEditor extends MultiPageEditorPart implements
IResourceChangeListener, PropertyChangeListener {
....
@Override
protected void createPages() {
// Configuration Page
createConfigurationPage();
// Product Page
createProductPage();
}
private void createConfigurationPage() {
Composite container = new Composite(getContainer(), SWT.NONE);
FillLayout layout = new FillLayout();
container.setLayout(layout);
tv = new CheckboxTreeViewer(container, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL);
tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
tv.setAutoExpandLevel(2);
tv.setContentProvider(new ConfigurationContentProvider());
tv.setLabelProvider(new ConfigurationLabelProvider());
tv.setExpandPreCheckFilters(true);
tv.setInput("root");
tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
// If the item is checked or not. . .
if (event.getChecked()) {
// . . . check all its children
tv.setSubtreeChecked(event.getElement(), true);
} else {
// . . . uncheck all its children
tv.setSubtreeChecked(event.getElement(), false);
}
}
});
int index = addPage(container);
setPageText(index, "Configuration");
}
private void createProductPage() {
Composite container = new Composite(getContainer(), SWT.NONE);
Label label = new Label(container, SWT.BORDER);
label.setLocation(100, 50);
label.setText("Concrete Product");
int index = addPage(container);
setPageText(index, "Product");
}
....
At least the label should work?
Cheers, Phil