@Override public StyledString getStyledText(final Object element) { final String label = getSimpleLabel(element); if (label == null) { return new StyledString(element.toString()); } StyledString text = new StyledString(label); final SubstepsTestElement testElement = (SubstepsTestElement) element; if (layoutMode.equals(ViewLayout.HIERARCHICAL)) { if (testElement.getParentContainer() instanceof SubstepsRunSession) { final String testKindDisplayName = testKindDisplayNameSupplier.get(); if (testKindDisplayName != null && testKindDisplayName.length() > 0) { final String decorated = MessageFormat.format( SubstepsFeatureMessages.TestSessionLabelProvider_testName_JUnitVersion, new Object[] {label, testKindDisplayName}); text = StyledCellLabelProvider.styleDecoratedString( decorated, StyledString.QUALIFIER_STYLER, text); } } } else { if (element instanceof SubstepsTestLeafElement) { final String decorated = MessageFormat.format( SubstepsFeatureMessages.TestSessionLabelProvider_testMethodName_className, label); text = StyledCellLabelProvider.styleDecoratedString( decorated, StyledString.QUALIFIER_STYLER, text); } } return addElapsedTime(text, testElement.getElapsedTimeInSeconds()); }
@Override public String getText(final Object element) { String label = getSimpleLabel(element); if (label == null) { return element.toString(); } final SubstepsTestElement testElement = (SubstepsTestElement) element; if (layoutMode.equals(ViewLayout.HIERARCHICAL)) { if (testElement.getParentContainer() instanceof SubstepsRunSession) { final String testKindDisplayName = testKindDisplayNameSupplier.get(); if (testKindDisplayName != null) { label = MessageFormat.format( SubstepsFeatureMessages.TestSessionLabelProvider_testName_JUnitVersion, new Object[] {label, testKindDisplayName}); } } } else { if (element instanceof SubstepsTestLeafElement) { label = MessageFormat.format( SubstepsFeatureMessages.TestSessionLabelProvider_testMethodName_className, label); } } return addElapsedTime(label, testElement.getElapsedTimeInSeconds()); }