ネスティング

外部の世界に対しては、すべてのパーツがブラック・ボックスです。 パーツは IPartFactory を使用して、ネストされた子を作成できますが、それが適合しているように見えても、その子は外部の世界には直接公開されません。 以下の例には、2 つのネストされた子があるビューが示されています。

/**
 * 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);

    }
}