コード例 #1
0
  protected JComponent createTestTreeView() {
    myTreeView = new SMTRunnerTestTreeView();

    myTreeView.setLargeModel(true);
    myTreeView.attachToModel(this);
    myTreeView.setTestResultsViewer(this);
    if (Registry.is("tests.view.old.statistics.panel")) {
      addTestsTreeSelectionListener(
          new TreeSelectionListener() {
            @Override
            public void valueChanged(TreeSelectionEvent e) {
              AbstractTestProxy selectedTest = getTreeView().getSelectedTest();
              if (selectedTest instanceof SMTestProxy) {
                myStatisticsPane.selectProxy(((SMTestProxy) selectedTest), this, false);
              }
            }
          });
    }

    final SMTRunnerTreeStructure structure = new SMTRunnerTreeStructure(myProject, myTestsRootNode);
    myTreeBuilder = new SMTRunnerTreeBuilder(myTreeView, structure);
    myTreeBuilder.setTestsComparator(TestConsoleProperties.SORT_ALPHABETICALLY.value(myProperties));
    Disposer.register(this, myTreeBuilder);

    myAnimator = new TestsProgressAnimator(myTreeBuilder);

    TrackRunningTestUtil.installStopListeners(
        myTreeView,
        myProperties,
        new Pass<AbstractTestProxy>() {
          @Override
          public void pass(AbstractTestProxy testProxy) {
            if (testProxy == null) return;
            // drill to the first leaf
            while (!testProxy.isLeaf()) {
              final List<? extends AbstractTestProxy> children = testProxy.getChildren();
              if (!children.isEmpty()) {
                final AbstractTestProxy firstChild = children.get(0);
                if (firstChild != null) {
                  testProxy = firstChild;
                  continue;
                }
              }
              break;
            }

            // pretend the selection on the first leaf
            // so if test would be run, tracking would be restarted
            myLastSelected = testProxy;
          }
        });

    // TODO always hide root node
    // myTreeView.setRootVisible(false);
    myUpdateQueue = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this);
    return myTreeView;
  }
コード例 #2
0
 public void showStatisticsForSelectedProxy() {
   TestConsoleProperties.SHOW_STATISTICS.set(myProperties, true);
   final AbstractTestProxy selectedProxy = myTreeView.getSelectedTest();
   showStatisticsForSelectedProxy(selectedProxy, true);
 }
コード例 #3
0
 public void addTestsTreeSelectionListener(final TreeSelectionListener listener) {
   myTreeView.getSelectionModel().addTreeSelectionListener(listener);
 }