Example #1
0
  public void testBindOnActivate() throws Exception {
    nodesBoundToView.clear();

    anotherNode.activate();

    assertTrue(nodesBoundToView.isEmpty());

    anotherNodeSameView.activate();

    assertTrue(nodesBoundToView.isEmpty());

    node.activate();
    assertEquals(1, nodesBoundToView.size());
    assertSame(node, nodesBoundToView.get(0));
  }
Example #2
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    shell = new Shell();
    parentComposite = new Composite(shell, SWT.NONE);
    addPluginXml(SubModuleViewTest.class, "SubModuleViewTest.xml");

    appNode = new ApplicationNode();
    final SubApplicationNode subAppNode = new SubApplicationNode();
    appNode.addChild(subAppNode);
    final ModuleGroupNode mgNode = new ModuleGroupNode(null);
    subAppNode.addChild(mgNode);
    moduleNode = new ModuleNode(null, "TestModuleLabel");
    mgNode.addChild(moduleNode);

    anotherNode = new SubModuleNode(new NavigationNodeId("testId2", "2"), "TestSubModuleLabel2");
    moduleNode.addChild(anotherNode);
    anotherNodeSameView =
        new SubModuleNode(new NavigationNodeId("testId", "1"), "TestSubModuleLabel3");
    moduleNode.addChild(anotherNodeSameView);
    nodesBoundToView = new ArrayList<SubModuleNode>();
    nodesBoundToSharedView = new ArrayList<SubModuleNode>();

    subModuleNodeView = new TestView();
    node = new SubModuleNode(new NavigationNodeId("testId", "0"), "TestSubModuleLabel");
    moduleNode.setNavigationNodeController(new ModuleController(moduleNode));
    moduleNode.addChild(node);
    subModuleNodeView.createPartControl(new Shell());
    node.activate();
  }
Example #3
0
 public void testShared() {
   subModuleNodeView.dispose();
   final SubModuleNode s1 = new SubModuleNode(new NavigationNodeId("s", "1"));
   final SubModuleNode s2 = new SubModuleNode(new NavigationNodeId("s", "2"));
   moduleNode.addChild(s1);
   moduleNode.addChild(s2);
   final TestSharedView subModuleNodeSharedView = new TestSharedView();
   subModuleNodeSharedView.s1 = s1;
   subModuleNodeSharedView.s2 = s2;
   subModuleNodeSharedView.createPartControl(new Shell());
   assertNotNull(s1.getNavigationNodeController());
   s1.activate();
   final SubModuleController s1c = (SubModuleController) s1.getNavigationNodeController();
   assertNotNull(s1c.getRidget("button"));
   assertEquals(nodesBoundToSharedView.get(0), s1);
   s2.activate();
   assertEquals(nodesBoundToSharedView.get(2), s2);
   s1.dispose();
   assertFalse(subModuleNodeSharedView.unbindActiveCalled);
   s2.dispose();
   assertTrue(subModuleNodeSharedView.unbindActiveCalled);
 }