Example usage for org.eclipse.jface.resource JFaceResources getColorRegistry

List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getColorRegistry.

Prototype

public static ColorRegistry getColorRegistry() 

Source Link

Document

Returns the color registry for JFace itself.

Usage

From source file:ext.org.eclipse.jdt.internal.ui.typehierarchy.MethodsLabelProvider.java

License:Open Source License

@Override
public void dispose() {
    JFaceResources.getColorRegistry().removeListener(fColorRegistryListener);
    fColorRegistryListener = null;
    super.dispose();
}

From source file:ext.org.eclipse.jdt.internal.ui.viewsupport.ColoredViewersManager.java

License:Open Source License

public void installColoredLabels(ColoringLabelProvider labelProvider) {
    if (fManagedLabelProviders.contains(labelProvider))
        return;/*from ww w.  j a va2 s. c  o  m*/

    if (fManagedLabelProviders.isEmpty()) {
        // first lp installed
        PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
        JFaceResources.getColorRegistry().addListener(this);
    }
    fManagedLabelProviders.add(labelProvider);
}

From source file:ext.org.eclipse.jdt.internal.ui.viewsupport.ColoredViewersManager.java

License:Open Source License

public void uninstallColoredLabels(ColoringLabelProvider labelProvider) {
    if (!fManagedLabelProviders.remove(labelProvider))
        return; // not installed

    if (fManagedLabelProviders.isEmpty()) {
        PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
        JFaceResources.getColorRegistry().removeListener(this);
        // last viewer uninstalled
    }//from w  w  w.  j a va2s  . com
}

From source file:fr.lip6.move.coloane.core.ui.files.ModelHandler.java

License:Open Source License

/**
 * Transform a string into a color//from  w  w  w .  j a v a  2s .co  m
 * @param value Color description under hexadecimal form '#XXXXXX'
 * @return The corresponding color
 * @throws NumberFormatException if the color string is not valid
 */
private Color parseColor(String value) throws NumberFormatException {
    if (value == null || !value.matches("#\\p{XDigit}{6}")) { //$NON-NLS-1$
        throw new NumberFormatException("This value : " + value + " is not a valid color."); //$NON-NLS-1$//$NON-NLS-2$
    }
    Color color = JFaceResources.getColorRegistry().get(value);
    if (color == null) {
        RGB rgb = new RGB(Integer.parseInt(value.substring(1, 3), 16),
                Integer.parseInt(value.substring(3, 5), 16), Integer.parseInt(value.substring(5, 7), 16));
        JFaceResources.getColorRegistry().put(value, rgb);
        color = JFaceResources.getColorRegistry().get(value);
    }
    return color;
}

From source file:fr.lip6.move.coloane.core.ui.prefs.ColorsPrefs.java

License:Open Source License

/**
 * Return a new Color based on preference string "r,g,b"
 * @param key color/*from   www.j  a v  a  2 s .  com*/
 * @return Color object Color
 */
public static Color getColor(String key) {
    Color color = JFaceResources.getColorRegistry().get(key);
    if (color == null) {
        RGB rgb = PreferenceConverter.getColor(Coloane.getInstance().getPreferenceStore(), key);
        JFaceResources.getColorRegistry().put(key, rgb);
        color = JFaceResources.getColorRegistry().get(key);
    }
    return color;
}

From source file:fr.obeo.releng.targetplatform.ui.editor.syntaxcoloring.TargetPlatformHighlightingConfiguration.java

License:Open Source License

public TextStyle versionRangeTextStyle() {
    TextStyle textStyle = defaultTextStyle().copy();
    textStyle.setColor(JFaceResources.getColorRegistry().getRGB(JFacePreferences.DECORATIONS_COLOR));
    return textStyle;
}

From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorConsole.java

License:Open Source License

/**
 * @param name//from w ww  .  j  av  a  2s .com
 * @param consoleType
 * @param imageDescriptor
 * @param encoding
 * @param autoLifecycle
 */
public GeneratorConsole(final ICodeGeneratorDescriptor desc) {
    super(desc.getName(), desc.getId(), GeneratorConsole.getConsoleImageDesc(desc));
    final IOConsoleOutputStream outIOStream = this.newOutputStream();
    outIOStream.setActivateOnWrite(false);
    this.outStream = new PrintStream(outIOStream);

    final IOConsoleOutputStream errIOStream = this.newOutputStream();
    errIOStream.setActivateOnWrite(true);
    errIOStream.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    this.errStream = new PrintStream(errIOStream);

    try {
        this.getInputStream().close();
    } catch (final IOException e) {
        RedhawkCodegenUiActivator.getDefault().getLog().log(new Status(IStatus.ERROR,
                RedhawkCodegenUiActivator.PLUGIN_ID, "Error in generator console.", e));
    }
}

From source file:gov.redhawk.internal.ui.preferences.OverridableDoubleFieldEditor.java

License:Open Source License

private void initColors(Text retVal) {
    defaultForeground = retVal.getForeground();
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    disabledForeground = colorRegistry.get("DarkGray");
    if (disabledForeground == null) {
        if (!colorRegistry.hasValueFor("DarkGray")) {
            colorRegistry.put("DarkGray", new RGB(0x69, 0x69, 0x69));
        }//from w  w  w .ja  v  a  2  s.c  o m
        disabledForeground = colorRegistry.get("DarkGray");
    }
}

From source file:gov.redhawk.internal.ui.preferences.ReadOnlyStringFieldEditor.java

License:Open Source License

private void initColors() {
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    textColor = colorRegistry.get("DarkGray");
    if (textColor == null) {
        if (!colorRegistry.hasValueFor("DarkGray")) {
            colorRegistry.put("DarkGray", new RGB(0x69, 0x69, 0x69));
        }//  www  . ja  v  a  2s  .  co  m
        textColor = colorRegistry.get("DarkGray");
    }
    getTextControl().setForeground(textColor);
}

From source file:it.unibz.instasearch.ui.ResultLabelProvider.java

License:Open Source License

public ResultLabelProvider(ResultContentProvider contentProvider) {
    JFaceResources.getColorRegistry().put(HIGHLIGHT_COLOR_NAME, new RGB(206, 204, 247));

    this.labelProvider = new WorkbenchLabelProvider();
    this.highlightStyle = StyledString.createColorRegistryStyler(null, HIGHLIGHT_COLOR_NAME);
    this.contentProvider = contentProvider;
    this.matchImage = InstaSearchUI.getSharedImage(IMG_OBJ_TEXT_SEARCH_LINE);

    imageRegistry.put(DOWN_ARROW_IMG_KEY, InstaSearchPlugin.getImageDescriptor(DOWN_ARROW_IMG_KEY));

    this.showMatchCount = InstaSearchPlugin.getBoolPref(PreferenceConstants.P_SHOW_MATCH_COUNT);
    this.showFullPath = InstaSearchPlugin.getBoolPref(PreferenceConstants.P_SHOW_FULL_PATH);

    InstaSearchPlugin.addPreferenceChangeListener(this);
}