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:org.talend.presentation.onboarding.utils.OnBoardingUtils.java

License:Open Source License

public static Color getColor(RGB rgb) {
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    String symbol = rgb.toString();
    Color color = colorRegistry.get(symbol);
    if (color == null) {
        colorRegistry.put(symbol, rgb);//  w  w w .ja v a 2  s  .c o m
    }
    return colorRegistry.get(symbol);
}

From source file:org.talend.repository.json.ui.wizards.extraction.JSONToXPathLinker.java

License:Open Source License

/**
 * DOC amaumont Comment method "initColors".
 * //  www. ja  v  a 2  s .  c  om
 * @param display
 */
private void initColors(Display display) {
    RGB selectedLoopLinkRGB = new RGB(255, 131, 0);
    RGB selectedRelativeLinkRGB = new RGB(110, 168, 255);
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    if (colorRegistry.get(selectedLoopLinkRGB.toString()) == null) {
        colorRegistry.put(selectedLoopLinkRGB.toString(), selectedLoopLinkRGB);
    }
    if (colorRegistry.get(selectedRelativeLinkRGB.toString()) == null) {
        colorRegistry.put(selectedRelativeLinkRGB.toString(), selectedRelativeLinkRGB);
    }
    selectedLoopLinkColor = colorRegistry.get(selectedLoopLinkRGB.toString());
    selectedRelativeLinkColor = colorRegistry.get(selectedRelativeLinkRGB.toString());

}

From source file:org.talend.repository.ui.login.AbstractLoginActionPage.java

License:Open Source License

public AbstractLoginActionPage(Composite parent, LoginDialogV2 dialog, int style) {
    super(parent, style);
    stackLayout = (StackLayout) parent.getLayout();
    this.loginDialog = dialog;
    this.setFont(JFaceResources.getFont(LoginDialogV2.FONT_TALEND_FOR_LOGIN_UI));
    this.backgroundColor = JFaceResources.getColorRegistry().get(LoginDialogV2.COLOR_LOGON_DIALOG_BACKGROUND);
}

From source file:org.talend.repository.ui.login.LoginDialogV2.java

License:Open Source License

/**
 * Construct a new LoginDialog./*  www.  j  a v  a  2  s.com*/
 * 
 * @param parentShell Parent shell.
 */
public LoginDialogV2(Shell parentShell) {
    super(parentShell);
    perReader = ConnectionUserPerReader.getInstance();
    setHelpAvailable(false);

    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    backgroundColor = colorRegistry.get(COLOR_LOGON_DIALOG_BACKGROUND);
    if (backgroundColor == null) {
        backgroundColor = ColorConstants.white;
        // backgroundColor = new Color(null, 215, 215, 215);
        colorRegistry.put(COLOR_LOGON_DIALOG_BACKGROUND, backgroundColor.getRGB());
    }
}

From source file:org.talend.themes.core.elements.stylesettings.CommonCSSStyleSetting.java

License:Open Source License

public static Color getColorByRGB(RGB rgb) {
    Color color = null;/*from  ww w . j  ava 2  s  .  c  o  m*/
    if (!JFaceResources.getColorRegistry().hasValueFor(rgb.toString())) {
        JFaceResources.getColorRegistry().put(rgb.toString(), rgb);
    }
    color = JFaceResources.getColorRegistry().get(rgb.toString());
    return color;
}

From source file:org.xmind.ui.properties.PropertiesEditor.java

License:Open Source License

private void initColorsFonts() {
    final IPropertyChangeListener colorChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            String colorId = event.getProperty();
            if (getColorFontId(COLOR_BACKGROUND).equals(colorId)) {
                updateBackgroundColor();
            } else if (getColorFontId(COLOR_CATEGORY_TITLE).equals(colorId)) {
                updateCategoryTitlesColor();
            } else if (getColorFontId(COLOR_ENTRY_FOREGROUND).equals(colorId)) {
                updateEntriesForegroundColor();
            } else if (getColorFontId(COLOR_ENTRY_SELECTED_BACKGROUND).equals(colorId)) {
                updateEntriesSelectedBackgroundColor();
            } else if (getColorFontId(COLOR_ENTRY_SELECTED_FOREGROUND).equals(colorId)) {
                updateEntriesSelectedForegroundColor();
            }//  w  w w.  j  av a  2  s  .  c  o m
        }
    };

    final IPropertyChangeListener fontChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            String fontId = event.getProperty();
            if (getColorFontId(FONT_CATEGORY_TITLE).equals(fontId)) {
                updateCategoryTitlesFont();
            } else if (getColorFontId(FONT_ENTRY).equals(fontId)) {
                updateEntriesFont();
            } else if (getColorFontId(FONT_ENTRY_SELECTED).equals(fontId)) {
                updateEntriesSelectedFont();
            }
        }
    };

    JFaceResources.getColorRegistry().addListener(colorChangeListener);
    JFaceResources.getFontRegistry().addListener(fontChangeListener);
    container.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            JFaceResources.getColorRegistry().removeListener(colorChangeListener);
            JFaceResources.getFontRegistry().removeListener(fontChangeListener);
        }
    });

    updateColorsFonts();
}

From source file:org.xmind.ui.properties.PropertiesEditor.java

License:Open Source License

private void updateBackgroundColor() {
    Color color = JFaceResources.getColorRegistry().get(getColorFontId(COLOR_BACKGROUND));
    container.setBackground(color);//from w w  w  .j av  a  2 s  . com
    getContents().setBackground(color);
    Iterator<Section> sections = sections();
    while (sections.hasNext()) {
        Section section = sections.next();
        if (section.section != null)
            section.section.setBackground(color);
    }
}

From source file:org.xmind.ui.properties.PropertiesEditor.java

License:Open Source License

private void updateCategoryTitlesColor() {
    Color color = JFaceResources.getColorRegistry().get(getColorFontId(COLOR_CATEGORY_TITLE));
    Iterator<Section> sections = sections();
    while (sections.hasNext()) {
        Section section = sections.next();
        if (section.section != null) {
            section.section.setTitleColor(color);
        }/*from   w w  w.  j a  v  a 2  s . co  m*/
    }
}

From source file:org.xmind.ui.properties.PropertiesEditor.java

License:Open Source License

private void updateEntriesForegroundColor() {
    Color color = JFaceResources.getColorRegistry().get(getColorFontId(COLOR_ENTRY_FOREGROUND));
    Iterator<PropertyEditingEntry> entries = entries();
    while (entries.hasNext()) {
        entries.next().setForeground(color);
    }//from   www  .  j  a  v a 2  s. c o  m
}

From source file:org.xmind.ui.properties.PropertiesEditor.java

License:Open Source License

private void updateEntriesSelectedBackgroundColor() {
    Color color = JFaceResources.getColorRegistry().get(getColorFontId(COLOR_ENTRY_SELECTED_BACKGROUND));
    Iterator<PropertyEditingEntry> entries = entries();
    while (entries.hasNext()) {
        entries.next().setSelectedBackground(color);
    }//from  w  ww.j a v  a  2 s .co m
}