Nesting

To the outside world, every part is a black box. The part can use IPartFactory to create nested children however it sees fit, but it does not expose those children directly to the outside world. The following example demonstrates a view with two nested children.

/**
 * Example view containing a nested error log on the left and a nested property
 * view on the right.
 *
 * @since 3.1
 */
public class TestCompositeView {
   
    public TestCompositeView(Composite parent, IPartFactory factory) throws CoreException {       
        // Create PDE error log view
        ContainerContext logViewContext = new ContainerContext();   
        ISite logView = factory.createView(
                "org.eclipse.pde.runtime.LogView",
                parent, logViewContext, null);

        // Create Property view
        ContainerContext emptyContext = new ContainerContext();
        ISite propertiesView = factory.createView(IPageLayout.ID_PROP_SHEET, parent, emptyContext, null);

        // Construct layout
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        parent.setLayout(layout);

        // Arrange error log view
        GridData data1 = new GridData(GridData.FILL_BOTH);
        logView.getControl().setLayoutData(data1);
       
        // Arrange properties view
        GridData data2 = new GridData(GridData.FILL_BOTH);
        propertiesView.getControl().setLayoutData(data2);

    }
}