Search in sources :

Example 1 with SMTRunnerNodeDescriptor

use of com.intellij.execution.testframework.sm.runner.SMTRunnerNodeDescriptor in project intellij-community by JetBrains.

the class TestTreeRenderer method customizeCellRenderer.

public void customizeCellRenderer(final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
    myRow = row;
    myDurationWidth = -1;
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    final Object userObj = node.getUserObject();
    if (userObj instanceof SMTRunnerNodeDescriptor) {
        final SMTRunnerNodeDescriptor desc = (SMTRunnerNodeDescriptor) userObj;
        final SMTestProxy testProxy = desc.getElement();
        if (testProxy instanceof SMTestProxy.SMRootTestProxy) {
            SMTestProxy.SMRootTestProxy rootTestProxy = (SMTestProxy.SMRootTestProxy) testProxy;
            if (node.isLeaf()) {
                TestsPresentationUtil.formatRootNodeWithoutChildren(rootTestProxy, this);
            } else {
                TestsPresentationUtil.formatRootNodeWithChildren(rootTestProxy, this);
            }
            if (myAdditionalRootFormatter != null) {
                myAdditionalRootFormatter.format(rootTestProxy, this);
            }
        } else {
            TestsPresentationUtil.formatTestProxy(testProxy, this);
        }
        if (TestConsoleProperties.SHOW_INLINE_STATISTICS.value(myConsoleProperties)) {
            String durationString = testProxy.getDurationString(myConsoleProperties);
            if (durationString != null) {
                durationString = "  " + durationString;
                myDurationWidth = getFontMetrics(getFont()).stringWidth(durationString);
                if (((TestTreeView) myTree).isExpandableHandlerVisibleForCurrentRow(myRow)) {
                    append(durationString);
                }
            }
        }
        //Done
        return;
    }
    //strange node
    final String text = node.toString();
    //no icon
    append(text != null ? text : SPACE_STRING, SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
Also used : SMTRunnerNodeDescriptor(com.intellij.execution.testframework.sm.runner.SMTRunnerNodeDescriptor) SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TestTreeView(com.intellij.execution.testframework.TestTreeView)

Aggregations

TestTreeView (com.intellij.execution.testframework.TestTreeView)1 SMTRunnerNodeDescriptor (com.intellij.execution.testframework.sm.runner.SMTRunnerNodeDescriptor)1 SMTestProxy (com.intellij.execution.testframework.sm.runner.SMTestProxy)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1