List of usage examples for org.eclipse.jface.viewers StyledCellLabelProvider styleDecoratedString
public static StyledString styleDecoratedString(String decoratedString, Styler decorationStyler, StyledString styledString)
From source file:com.google.dart.tools.search.internal.ui.text.FileLabelProvider.java
License:Open Source License
public StyledString getStyledString(File resource) { if (!resource.exists()) { return new StyledString(SearchMessages.FileLabelProvider_removed_resource_label); }/*from ww w. j av a2 s. c o m*/ String name = BasicElementLabels.getResourceName(resource); if (fOrder == SHOW_LABEL) { return getColoredLabelWithCounts(resource, new StyledString(name)); } String pathString = BasicElementLabels.getParentPathLabel(resource, false); if (fOrder == SHOW_LABEL_PATH) { StyledString str = new StyledString(name); String decorated = Messages.format(fgSeparatorFormat, new String[] { str.getString(), pathString }); StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); return getColoredLabelWithCounts(resource, str); } StyledString str = new StyledString(Messages.format(fgSeparatorFormat, new String[] { pathString, name })); return getColoredLabelWithCounts(resource, str); }
From source file:com.google.dart.tools.search.internal.ui.text.FileLabelProvider.java
License:Open Source License
public StyledString getStyledString(IResource resource) { if (!resource.exists()) { return new StyledString(SearchMessages.FileLabelProvider_removed_resource_label); }//from w ww . j av a 2 s. c o m String name = BasicElementLabels.getResourceName(resource); if (fOrder == SHOW_LABEL) { return getColoredLabelWithCounts(resource, new StyledString(name)); } String pathString = BasicElementLabels.getPathLabel(resource.getParent().getFullPath(), false); if (fOrder == SHOW_LABEL_PATH) { StyledString str = new StyledString(name); String decorated = Messages.format(fgSeparatorFormat, new String[] { str.getString(), pathString }); StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); return getColoredLabelWithCounts(resource, str); } StyledString str = new StyledString(Messages.format(fgSeparatorFormat, new String[] { pathString, name })); return getColoredLabelWithCounts(resource, str); }
From source file:com.google.dart.tools.ui.callhierarchy.CallHierarchyLabelProvider.java
License:Open Source License
@Override public StyledString getStyledText(Object element) { if (isNormalMethodWrapper(element)) { MethodWrapper wrapper = (MethodWrapper) element; String decorated = getElementLabel(wrapper); StyledString styledLabel = super.getStyledText(wrapper.getMember()); StyledString styledDecorated = StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.COUNTER_STYLER, styledLabel); if (isSpecialConstructorNode(wrapper)) { decorated = Messages.format(CallHierarchyMessages.CallHierarchyLabelProvider_constructor_label, decorated);/*from w w w .j a v a 2 s. c om*/ styledDecorated = StyledCellLabelProvider.styleDecoratedString(decorated, ColoringLabelProvider.INHERITED_STYLER, styledDecorated); } return styledDecorated; } String specialLabel = getSpecialLabel(element); Styler styler = element instanceof RealCallers ? ColoringLabelProvider.INHERITED_STYLER : null; return new StyledString(specialLabel, styler); }
From source file:com.google.dart.tools.ui.internal.search.SearchLabelProvider.java
License:Open Source License
@Override public StyledString getStyledText(Object element) { StyledString string = DartElementLabels.getStyledTextLabel(element, (evaluateTextFlags(element) | DartElementLabels.COLORIZE)); if (string.length() == 0 && (element instanceof IStorage)) { string = new StyledString(fStorageLabelProvider.getText(element)); }/*ww w.j av a 2 s .c om*/ String decorated = decorateText(string.getString(), element); if (decorated != null) { return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.DECORATIONS_STYLER, string); } return string; }
From source file:com.google.dart.tools.ui.internal.search.SearchLabelProvider.java
License:Open Source License
protected final StyledString getColoredLabelWithCounts(Object element, StyledString coloredName) { String name = coloredName.getString(); String decorated = getLabelWithCounts(element, name); if (decorated.length() > name.length()) { StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.COUNTER_STYLER, coloredName); }// w ww . j a v a 2 s . co m return coloredName; }
From source file:com.google.dart.tools.ui.internal.text.correction.proposals.AbstractActionProposal.java
License:Open Source License
@Override public StyledString getStyledDisplayString() { StyledString str = new StyledString(label); String shortCutString = CorrectionCommandHandler.getShortCutString(getCommandId()); if (shortCutString != null) { String decorated = Messages.format(CorrectionMessages.ChangeCorrectionProposal_name_with_shortcut, new String[] { label, shortCutString }); return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); }//from w w w.ja v a 2 s .c o m return str; }
From source file:com.google.dart.tools.ui.internal.text.correction.proposals.ChangeCorrectionProposal.java
License:Open Source License
@Override public StyledString getStyledDisplayString() { StyledString str = new StyledString(getName()); String shortCutString = CorrectionCommandHandler.getShortCutString(getCommandId()); if (shortCutString != null) { String decorated = Messages.format(CorrectionMessages.ChangeCorrectionProposal_name_with_shortcut, new String[] { getName(), shortCutString }); return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); }/*w w w. jav a 2s. c o m*/ return str; }
From source file:com.google.dart.tools.ui.internal.text.correction.proposals.LinkedNamesAssistProposal.java
License:Open Source License
@Override public StyledString getStyledDisplayString() { StyledString str = new StyledString(fLabel); String shortCutString = CorrectionCommandHandler.getShortCutString(getCommandId()); if (shortCutString != null) { String decorated = Messages.format(CorrectionMessages.ChangeCorrectionProposal_name_with_shortcut, new String[] { fLabel, shortCutString }); return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); }// w w w. j ava 2 s. c om return str; }
From source file:com.google.dart.tools.ui.internal.text.correction.proposals.RenameRefactoringProposal.java
License:Open Source License
@Override public StyledString getStyledDisplayString() { StyledString str = new StyledString(fLabel); String shortCutString = CorrectionCommandHandler.getShortCutString(getCommandId()); if (shortCutString != null) { String decorated = Messages.format(CorrectionMessages.ChangeCorrectionProposal_name_with_shortcut, new String[] { fLabel, shortCutString }); return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, str); }//from w ww. j a va 2 s.c om return str; }
From source file:com.mobilesorcery.sdk.testing.internal.ui.TestSessionLabelProvider.java
License:Open Source License
public void update(ViewerCell cell) { Object element = cell.getElement(); String mainText = getText(element); StyledString text = new StyledString(mainText); String elapsedTimeText = getElapsedTimeText(element); if (elapsedTimeText != null) { text = StyledCellLabelProvider.styleDecoratedString( MessageFormat.format("{0} {1}", text, elapsedTimeText), StyledString.COUNTER_STYLER, text); }//w w w .j av a 2s. c o m cell.setText(text.getString()); cell.setStyleRanges(text.getStyleRanges()); Image image = getImage(element); cell.setImage(image); }