List of usage examples for org.eclipse.jface.viewers ILabelDecorator decorateText
public String decorateText(String text, Object element);
From source file:com.aptana.ide.views.outline.UnifiedOutlineProvider.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object) */// w ww. j av a 2s . c o m public String decorateText(String text, Object element) { String result = null; switchLanguage(element); if (this._currentProviders != null) { ILabelDecorator labelDecorator = this._currentProviders.labelDecorator; if (labelDecorator != null) { result = labelDecorator.decorateText(text, element); } } return result; }
From source file:com.google.dart.tools.ui.internal.text.editor.NewDartElementLabelProvider.java
License:Open Source License
protected String decorateText(String text, Object element) { if (labelDecorators != null && text != null && text.length() > 0) { for (ILabelDecorator decorator : labelDecorators) { String decorated = decorator.decorateText(text, element); if (decorated != null) { text = decorated;//from ww w .j ava2 s . c om } } } return text; }
From source file:com.google.dart.tools.ui.internal.viewsupport.DartUILabelProvider.java
License:Open Source License
protected String decorateText(String text, Object element) { if (fLabelDecorators != null && text.length() > 0) { for (int i = 0; i < fLabelDecorators.size(); i++) { ILabelDecorator decorator = fLabelDecorators.get(i); String decorated = decorator.decorateText(text, element); if (decorated != null) { text = decorated;//from ww w . j av a2 s . co m } } } return text; }
From source file:com.google.dart.tools.ui.internal.viewsupport.DecoratingDartLabelProvider.java
License:Open Source License
@Override public ColoredString getRichTextLabel(Object element) { ILabelProvider labelProvider = getLabelProvider(); if (labelProvider instanceof IRichLabelProvider) { // get a rich label from the label decorator IRichLabelProvider richLabelProvider = (IRichLabelProvider) labelProvider; ColoredString richLabel = richLabelProvider.getRichTextLabel(element); if (richLabel != null) { String decorated = null; ILabelDecorator labelDecorator = getLabelDecorator(); if (labelDecorator != null) { if (labelDecorator instanceof LabelDecorator) { decorated = ((LabelDecorator) labelDecorator).decorateText(richLabel.getString(), element, getDecorationContext()); } else { decorated = labelDecorator.decorateText(richLabel.getString(), element); }//w w w .j a v a 2 s . c o m } if (decorated != null) { return ColoredDartElementLabels.decorateColoredString(richLabel, decorated, ColoredDartElementLabels.DECORATIONS_STYLE); } return richLabel; } } return null; }
From source file:de.femodeling.e4.ui.progress.internal.ProgressInfoItem.java
License:Open Source License
/** * Create a new instance of the receiver with the specified parent, style * and info object///from w w w . jav a 2 s .c om * * @param parent * @param style * @param progressInfo */ public ProgressInfoItem(Composite parent, int style, JobTreeElement progressInfo) { super(parent, style); info = progressInfo; createChildren(); setData(info); setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); ILabelDecorator labelDecorator = PlatformUI.getWorkbench().getDecoratorManager() .getLabelDecorator(ContributingPluginDecorator.ID); if (labelDecorator != null && info.isJobInfo()) { setToolTipText(labelDecorator.decorateText(getMainTitle(), ((JobInfo) info).getJob())); } }
From source file:descent.internal.ui.viewsupport.JavaUILabelProvider.java
License:Open Source License
protected String decorateText(String text, Object element) { if (fLabelDecorators != null && text.length() > 0) { for (int i = 0; i < fLabelDecorators.size(); i++) { ILabelDecorator decorator = (ILabelDecorator) fLabelDecorators.get(i); text = decorator.decorateText(text, element); }//from w ww .j ava2 s . c o m } return text; }
From source file:net.sourceforge.tagsea.resources.sharing.ui.MultiLabelDecorator.java
License:Open Source License
public String decorateText(String text, Object element) { for (int i = 0; i < decorators.length; i++) { ILabelDecorator decorator = decorators[i]; String newText = decorator.decorateText(text, element); if (newText != null) { text = newText;// w w w . j av a 2 s. co m } } return text; }
From source file:org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser.java
License:Open Source License
private void updateLabel(CTabItem tab, IMemoryRendering rendering) { // The default is to use the label provided by the base rendering // interface. String label = rendering.getLabel(); // If the rendering provides access to its viewport address (the first // address shown in the rendering, subject to scrolling), display that // in the tab rather than the expression that was used when the tab was // first created. if (rendering instanceof IMemoryRenderingViewportProvider) { BigInteger viewportAddress = ((IMemoryRenderingViewportProvider) rendering).getViewportAddress(); // The base label generation puts the rendering type name in "<>" and // appends it to the label. Fish that out String renderingType = null; int i = label.indexOf('<'); if (i >= 0) { renderingType = label.substring(i); }/* www .j a v a 2 s .c o m*/ label = null; // If a memory space is involved, we want to include its ID in the label String memorySpaceID = (String) tab.getData(KEY_MEMORY_SPACE); if (memorySpaceID != null) { IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval) tab.getParent().getData(KEY_RETRIEVAL); if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { label = ((IMemorySpaceAwareMemoryBlockRetrieval) retrieval) .encodeAddress("0x" + viewportAddress.toString(16), memorySpaceID); } } if (label == null) { label = "0x" + viewportAddress.toString(16); } // If the expression that was went to ("Go") is not a hex address, // or it is but the user has scrolled/paged, then show the // expression after the viewport hex address. Additionally, if some // scrolling/paging has moved the viewport, also show the relative // displacement. E.g., // "0x10020 - gSomeVar(+20) <Traditional>" // (for a tab where the user did a "Go" to "gSomeVar" then paged // down, and where gSomeVar is at 0x10000) // String expression = (String) tab.getData(KEY_EXPRESSION); BigInteger evaluatedAddress = (BigInteger) tab.getData(KEY_EXPRESSION_ADDRESS); if (expression != null && !expression.equals("0x" + viewportAddress.toString(16))) { label += " - " + expression; BigInteger delta = evaluatedAddress.subtract(viewportAddress); if (!delta.equals(BigInteger.ZERO)) { label += "("; label += delta.signum() < 0 ? '+' : '-'; label += "0x" + delta.abs().toString(16) + ")"; } } label += ' ' + renderingType; ; // Allow the memory block to customize the label. The platform's // Memory view support this (it was done in the call to // rendering.getLabel() above) IMemoryBlock block = rendering.getMemoryBlock(); ILabelDecorator labelDec = (ILabelDecorator) block.getAdapter(ILabelDecorator.class); if (labelDec != null) { String newLabel = labelDec.decorateText(label, rendering); if (newLabel != null) { label = newLabel; } } } tab.setText(label); }
From source file:org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider.java
License:Open Source License
protected String decorateText(String text, Object element) { if (fLabelDecorators != null && text.length() > 0) { for (int i = 0; i < fLabelDecorators.size(); i++) { ILabelDecorator decorator = fLabelDecorators.get(i); text = decorator.decorateText(text, element); }/* w ww . j ava 2 s . com*/ } return text; }
From source file:org.eclipse.datatools.sqltools.sqleditor.internal.editor.SQLLabelProvider.java
License:Open Source License
protected String decorateText(String text, Object element) { if (_fLabelDecorators != null && text.length() > 0) { for (int i = 0; i < _fLabelDecorators.size(); i++) { ILabelDecorator decorator = (ILabelDecorator) _fLabelDecorators.get(i); text = decorator.decorateText(text, element); }/* w w w. jav a2 s . com*/ } return text; }