org.eclipse.ui.themes.ColorUtil Java Examples

The following examples show how to use org.eclipse.ui.themes.ColorUtil. 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: ColorSetting.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * You must dispose the color setting when it is no longer required.
 *
 * @param foreground
 *            The foreground color, or null to use the default system color
 * @param background
 *            The background color, or null to use the default system color
 * @param tickColorRGB
 *            The color for the time graph ticks, or null to use the default system color
 * @param filter
 *            The filter tree node, or null
 */
public ColorSetting(@Nullable RGB foreground, @Nullable RGB background, @Nullable RGB tickColorRGB, @Nullable ITmfFilterTreeNode filter) {
    fForegroundRGB = foreground;
    fBackgroundRGB = background;
    fTickColorRGB = (tickColorRGB != null) ? tickColorRGB : checkNotNull(Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
    fFilter = filter;
    Display display = Display.getDefault();
    fForegroundColor = (fForegroundRGB != null) ? new Color(display, fForegroundRGB) : null;
    fBackgroundColor = (fBackgroundRGB != null) ? new Color(display, fBackgroundRGB) : null;
    fDimmedForegroundColor = new Color(display, ColorUtil.blend(
            (fForegroundRGB != null) ? fForegroundRGB : display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB(),
            (fBackgroundRGB != null) ? fBackgroundRGB : display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
    fDimmedBackgroundColor = (fBackgroundRGB == null) ? null : new Color(display, ColorUtil.blend(
            fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
    fTickColor = new Color(display, fTickColorRGB);
}
 
Example #2
Source File: TmfEventsTable.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create the resources.
 */
private void createResources() {
    ColorRegistry colorRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    Color c = colorRegistry.get("org.eclipse.tracecompass.tmf.ui.FOREGROUND"); //$NON-NLS-1$
    if (c != null) {
        fGrayColor = c;
    } else {
        fGrayColor = fResourceManager.createColor(ColorUtil.blend(fTable.getBackground().getRGB(), fTable.getForeground().getRGB()));
    }
    fGreenColor = PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN);
}