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);
}
Aggregations