Esempio n. 1
0
  public void testGrayed() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
    TestElement element = fRootElement.getFirstChild();

    assertTrue(ctv.getGrayedElements().length == 0);
    assertTrue(!ctv.getGrayed(element));

    ctv.setGrayed(element, true);
    assertTrue(ctv.getGrayedElements().length == 1);
    assertTrue(ctv.getGrayed(element));

    ctv.setGrayed(element, false);
    assertTrue(ctv.getGrayedElements().length == 0);
    assertTrue(!ctv.getGrayed(element));
  }
Esempio n. 2
0
  public void testParentGrayed() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
    TestElement first = fRootElement.getFirstChild();
    TestElement firstfirst = first.getFirstChild();
    TestElement firstfirstfirst = firstfirst.getFirstChild();
    ctv.expandToLevel(firstfirstfirst, 0);

    ctv.setParentsGrayed(firstfirstfirst, true);
    Object[] elements = ctv.getGrayedElements();
    assertTrue(elements.length == 3);
    for (int i = 0; i < elements.length; ++i) {
      assertTrue(ctv.getGrayed(elements[i]));
    }

    assertTrue(elements[0] == first);
    assertTrue(elements[1] == firstfirst);
    assertTrue(elements[2] == firstfirstfirst);
    ctv.setParentsGrayed(firstfirstfirst, false);
  }