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); } return coloredName; }
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); } return coloredName; }
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); } return coloredName; }
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); } return coloredName; }
@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); } return str; }
private StyledString getStyledText(Object element, IStyledLabelProvider provider) { StyledString string = provider.getStyledText(element); if (selectionDecorator != null && isSelected(element)) { String decorated = selectionDecorator.decorateText(string.getString(), element); return StyledCellLabelProvider.styleDecoratedString(decorated, null, string); // no need to add colors when element is selected } return string; }
@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); } return str; }
@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); } return str; }
@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); } return str; }
@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); 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); }
@Override public StyledString getStyledDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; String decorated= Messages.format(TemplateContentAssistMessages.TemplateProposal_displayString, arguments); StyledString string= new StyledString(fTemplate.getName(), StyledString.COUNTER_STYLER); fDisplayString= StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, string); } return fDisplayString; }
@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); 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); }
@Override public StyledString getStyledDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; String decorated= Messages.format(TemplateContentAssistMessages.TemplateProposal_displayString, arguments); StyledString string= new StyledString(fTemplate.getName(), StyledString.COUNTER_STYLER); fDisplayString= StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, string); } return fDisplayString; }
@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); } return str; }
@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); } return str; }
@Override public StyledString getStyledText(Object element) { StyledString string= JavaElementLabels.getStyledTextLabel(element, (evaluateTextFlags(element) | JavaElementLabels.COLORIZE)); if (string.length() == 0 && (element instanceof IStorage)) { string= new StyledString(fStorageLabelProvider.getText(element)); } String decorated= decorateText(string.getString(), element); if (decorated != null) { return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.DECORATIONS_STYLER, string); } return string; }
@Override public StyledString getStyledText(Object element) { StyledString string= JavaElementLabels.getStyledTextLabel(element, (evaluateTextFlags(element) | JavaElementLabels.COLORIZE)); if (string.length() == 0 && (element instanceof IStorage)) { string= new StyledString(fStorageLabelProvider.getText(element)); } String decorated= decorateText(string.getString(), element); if (decorated != null) { return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.DECORATIONS_STYLER, string); } return string; }
/** * Returns the styled text for the label of the given element. * * @param element * the element for which to provide the styled label text * @return the styled text string used to label the element */ @Override protected StyledString getStyledText(Object element) { StyledString styledString = super.getStyledText(element); if (this.decorator == null) { return styledString; } String label = styledString.getString(); String decorated; if (this.decorator instanceof LabelDecorator) { decorated = ((LabelDecorator) this.decorator).decorateText(label, element, getDecorationContext()); } else { decorated = this.decorator.decorateText(label, element); } if (decorated == null) return styledString; Styler style = getDecorationStyle(element); return StyledCellLabelProvider.styleDecoratedString(decorated, style, styledString); }
String[] arg= new String[] { currentTemplate.getName(), currentTemplate.getDescription() }; String decorated= Messages.format(CorrectionMessages.QuickTemplateProcessor_surround_label, arg); proposal.setDisplayString(StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, new StyledString(currentTemplate.getName()))); result.add(proposal); } else { String[] arg= new String[] { currentTemplate.getName(), currentTemplate.getDescription() }; String decorated= Messages.format(CorrectionMessages.QuickTemplateProcessor_surround_label, arg); proposal.setDisplayString(StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, new StyledString(currentTemplate.getName()))); result.add(proposal);
@Override public StyledString getStyledText(Object element) { if (element instanceof LineElement) return getLineElementLabel((LineElement) element); if (!(element instanceof IResource)) return new StyledString(); IResource resource= (IResource) element; if (!resource.exists()) new StyledString(SearchMessages.FileLabelProvider_removed_resource_label); 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); }