Creating an editor page with sections doesn't work (eclipse, java)

I am trying to create a multi-page editor similar to the manifest editor. I used the wizard for multi-page editors and tried to make a really very simple page by following the tutorial

 void createPage0() {

    Composite composite = new Composite(getContainer(), SWT.DEFAULT);

    FormToolkit toolkit = new FormToolkit(composite.getDisplay());
    ScrolledForm scrollform= toolkit.createScrolledForm(composite);
    scrollform.setText("Test Viewer");

    toolkit.decorateFormHeading(form.getForm());

    int index = addPage(composite);
    setPageText(index, "editor1");
}

      

If I run this in eclipse, the first page of the editor is just gray with nothing to display. (Let's assume this is the title according to the tutorial)

Does anyone know why this is not working?

+3


source to share


2 answers


You need to set the layout to Composite

in order for it to fill the data area:

Composite composite = new Composite(getContainer(), SWT.NONE);

composite.setLayout(new FillLayout());

      



If you want to use the code frequently FormToolkit

then FormEditor

provides additional support for that.

+1


source


you have to override addPages()

.



JavaDoc says: A subclass must implement this method to add pages to the editor using the method addPage(IFormPage)

.

0


source







All Articles