0

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

flavio.donze
  • 7,432
  • 9
  • 58
  • 91
ph09
  • 1,052
  • 2
  • 20
  • 31

1 Answers1

0

In createProductPage you are not setting a layout on the Composite which is stopping it displaying.

On a quick test here I added SWT.BORDER to the tree viewer and it is filling the page so perhaps your content provider is not working.

greg-449
  • 109,219
  • 232
  • 102
  • 145