org.eclipse.jface.viewers.IColorProvider Java Examples
The following examples show how to use
org.eclipse.jface.viewers.IColorProvider.
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: CContainerViewer.java From nebula with Eclipse Public License 2.0 | 6 votes |
protected void doUpdateCell(int index, CContainerCell cell, Object element, String[] properties) { IBaseLabelProvider prov = (IBaseLabelProvider) getLabelProvider(); if(prov != null) { Color background = null; Color foreground = null; if(prov instanceof ITableColorProvider) { background = ((ITableColorProvider) prov).getBackground(element, index); foreground = ((ITableColorProvider) prov).getForeground(element, index); } else if(prov instanceof IColorProvider) { background = ((IColorProvider) prov).getBackground(element); foreground = ((IColorProvider) prov).getForeground(element); } if(background != null) cell.setCellBackground(background); if(foreground != null) cell.setCellForeground(foreground); // TODO doUpdateItem - set fonts... } }
Example #2
Source File: ColorDecoratingLabelProvider.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
@Override public Color getForeground(Object element) { ILabelProvider labelProvider = getLabelProvider(); if ((labelProvider instanceof IColorProvider)) return ((IColorProvider)labelProvider).getForeground(element); return null; }
Example #3
Source File: ColorDecoratingLabelProvider.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
@Override public Color getBackground(Object element) { ILabelProvider labelProvider = getLabelProvider(); if ((labelProvider instanceof IColorProvider)) return ((IColorProvider)labelProvider).getBackground(element); return null; }
Example #4
Source File: TimelineViewer.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void update(Object element, String[] properties) { final IFigure figure = fElementToFigureMap.get(element); if (figure != null) { if (isCursorElement(element)) getControl().getRootFigure().updateCursorFigure(figure, toCursor(element)); else if (isTrackElement(element)) getControl().getRootFigure().updateTrackFigure(figure, getLabelProvider().getText(element)); else if (isEventElement(element)) getControl().getRootFigure().updateEventFigure(figure, toEvent(element)); else if (isLaneElement(element)) { if (getLabelProvider() instanceof IColorProvider) { // color update for all elements Color foreground = ((IColorProvider) getLabelProvider()).getForeground(element); if (foreground == null) foreground = getStyleProvider().getLaneColor(); figure.setForegroundColor(foreground); internalRefresh(element); } } } }
Example #5
Source File: TimelineViewer.java From nebula with Eclipse Public License 2.0 | 5 votes |
private ITimelineEvent toEvent(Object element) { if (element instanceof ITimelineEvent) return (ITimelineEvent) element; final Timing timings = getLabelProvider().getTimings(element); if (timings != null) { final ITimelineEvent event = ITimelineFactory.eINSTANCE.createTimelineEvent(); event.setStartTimestamp((long) timings.getTimestamp()); event.setDuration((long) timings.getDuration()); final ITimelineLabelProvider labelProvider = getLabelProvider(); event.setTitle(labelProvider.getText(element)); if (labelProvider instanceof IToolTipProvider) event.setMessage(((IToolTipProvider) labelProvider).getToolTipText(element)); if (labelProvider instanceof IColorProvider) { final Color color = ((IColorProvider) labelProvider).getForeground(element); if (color != null) event.setColorCode(toColorCode(color)); } return event; } return null; }
Example #6
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 5 votes |
private Color getBackground(Object element) { if (element instanceof ItemsListSeparator) { return null; } if (provider instanceof IColorProvider) { return ((IColorProvider) provider).getBackground(element); } return null; }
Example #7
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 5 votes |
private Color getForeground(Object element) { if (element instanceof ItemsListSeparator) { return Display.getCurrent().getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW); } if (provider instanceof IColorProvider) { return ((IColorProvider) provider).getForeground(element); } return null; }
Example #8
Source File: ThemedDelegatingLabelProvider.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Color getForeground(Object element) { if (disabled || !invasiveThemesEnabled()) { if (wrapped instanceof IColorProvider) { return ((IColorProvider) wrapped).getForeground(element); } return null; } return getThemeManager().getCurrentTheme().getForegroundColor(); }