Java Code Examples for org.eclipse.jface.viewers.StyledCellLabelProvider#styleDecoratedString()
The following examples show how to use
org.eclipse.jface.viewers.StyledCellLabelProvider#styleDecoratedString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallHierarchyLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@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); }
Example 2
Source File: WorkbenchLabelProvider.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * The default implementation of this returns the styled text label for the given element. * @param element * the element to evaluate the styled string for * @return the styled string. * @since 3.7 */ public StyledString getStyledText(Object element) { IWorkbenchAdapter3 adapter = getAdapter3(element); if (adapter == null) { // If adapter class doesn't implement IWorkbenchAdapter3 than use // StyledString with text of element. Since the output of getText is // already decorated, so we don't need to call decorateText again // here. return new StyledString(getText(element)); } StyledString styledString = adapter.getStyledText(element); // Now, re-use any existing decorateText implementation, to decorate // this styledString. String decorated = decorateText(styledString.getString(), element); Styler styler = getDecorationStyle(element); return StyledCellLabelProvider.styleDecoratedString(decorated, styler, styledString); }
Example 3
Source File: WorkbenchLabelProvider.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * The default implementation of this returns the styled text label for the given element. * @param element * the element to evaluate the styled string for * @return the styled string. * @since 3.7 */ public StyledString getStyledText(Object element) { IWorkbenchAdapter3 adapter = getAdapter3(element); if (adapter == null) { // If adapter class doesn't implement IWorkbenchAdapter3 than use // StyledString with text of element. Since the output of getText is // already decorated, so we don't need to call decorateText again // here. return new StyledString(getText(element)); } StyledString styledString = adapter.getStyledText(element); // Now, re-use any existing decorateText implementation, to decorate // this styledString. String decorated = decorateText(styledString.getString(), element); Styler styler = getDecorationStyle(element); return StyledCellLabelProvider.styleDecoratedString(decorated, styler, styledString); }
Example 4
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 5 votes |
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; }
Example 5
Source File: ChangeCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example 6
Source File: TextSearchLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example 7
Source File: SearchLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example 8
Source File: TemplateProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example 9
Source File: LinkedNamesAssistProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example 10
Source File: RenameRefactoringProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }