コード例 #1
0
  public void testCreateWindow() {
    final MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
    window.setLabel("MyWindow");
    wb = new E4Workbench(window, appContext);

    Widget topWidget = (Widget) window.getWidget();
    assertTrue(topWidget instanceof Shell);
    assertEquals("MyWindow", ((Shell) topWidget).getText());
    assertEquals(topWidget, appContext.get(IServiceConstants.ACTIVE_SHELL));
  }
コード例 #2
0
  private MWindow createWindowWithOneView(String partName) {
    final MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
    window.setHeight(300);
    window.setWidth(400);
    window.setLabel("MyWindow");
    MPartSashContainer sash = BasicFactoryImpl.eINSTANCE.createPartSashContainer();
    window.getChildren().add(sash);
    MPartStack stack = BasicFactoryImpl.eINSTANCE.createPartStack();
    sash.getChildren().add(stack);
    MPart contributedPart = BasicFactoryImpl.eINSTANCE.createPart();
    stack.getChildren().add(contributedPart);
    contributedPart.setLabel(partName);
    contributedPart.setContributionURI(
        "bundleclass://org.eclipse.e4.ui.tests/org.eclipse.e4.ui.tests.workbench.SampleView");

    return window;
  }