Search in sources :

Example 1 with TestsProgressAnimator

use of com.intellij.execution.testframework.ui.TestsProgressAnimator in project intellij-community by JetBrains.

the class SMTestRunnerResultsForm method createTestTreeView.

protected JComponent createTestTreeView() {
    myTreeView = new SMTRunnerTestTreeView();
    myTreeView.setLargeModel(true);
    myTreeView.attachToModel(this);
    myTreeView.setTestResultsViewer(this);
    final SMTRunnerTreeStructure structure = new SMTRunnerTreeStructure(myProject, myTestsRootNode);
    myTreeBuilder = new SMTRunnerTreeBuilder(myTreeView, structure);
    myTreeBuilder.setTestsComparator(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;
            final AbstractTestProxy selectedProxy = testProxy;
            //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;
            //ensure scroll to source on explicit selection only
            if (ScrollToTestSourceAction.isScrollEnabled(SMTestRunnerResultsForm.this)) {
                final Navigatable descriptor = TestsUIUtil.getOpenFileDescriptor(selectedProxy, SMTestRunnerResultsForm.this);
                if (descriptor != null) {
                    OpenSourceUtil.navigate(false, descriptor);
                }
            }
        }
    });
    //myTreeView.setRootVisible(false);
    return myTreeView;
}
Also used : TestsProgressAnimator(com.intellij.execution.testframework.ui.TestsProgressAnimator) List(java.util.List) Navigatable(com.intellij.pom.Navigatable)

Aggregations

TestsProgressAnimator (com.intellij.execution.testframework.ui.TestsProgressAnimator)1 Navigatable (com.intellij.pom.Navigatable)1 List (java.util.List)1