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

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

Introduction

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

Prototype

public static FontRegistry getFontRegistry() 

Source Link

Document

Returns the font registry for JFace itself.

Usage

From source file:org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.PFLinkFigure.java

License:Open Source License

/**
 * get the label's font from preference/*w  ww .j  a v  a  2  s  .  c om*/
 * 
 */
private Font getLabelFont() {
    FontRegistry registry = JFaceResources.getFontRegistry();
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    FontData fontData = PreferenceConverter.getFontData(store, GEMPreferences.LINE_LABEL_FONT);
    if (!registry.get(fontData.toString()).equals(registry.defaultFont()))
        return registry.get(fontData.toString());

    registry.put(fontData.toString(), new FontData[] { fontData });
    return registry.get(fontData.toString());
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowEditor.java

License:Open Source License

private Font getLinkLabelFont() {
    FontRegistry registry = JFaceResources.getFontRegistry();
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    FontData fontData = PreferenceConverter.getFontData(store, GEMPreferences.LINE_LABEL_FONT);
    if (!registry.get(fontData.toString()).equals(registry.defaultFont()))
        return registry.get(fontData.toString());

    registry.put(fontData.toString(), new FontData[] { fontData });
    return registry.get(fontData.toString());
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowEditor.java

License:Open Source License

private Font getNodeLabelFont() {
    FontRegistry registry = JFaceResources.getFontRegistry();
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    FontData fontData = PreferenceConverter.getFontData(store, GEMPreferences.FIGURE_LABEL_FONT);
    if (!registry.get(fontData.toString()).equals(registry.defaultFont()))
        return registry.get(fontData.toString());

    registry.put(fontData.toString(), new FontData[] { fontData });
    return registry.get(fontData.toString());
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.BaseFigureDecorator.java

License:Open Source License

public Font getFont() {
    Font localFont = getLocalFont();
    if (localFont == null) {
        localFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
        // TODO: it's not clear that setFont is correct to call
        // here since this does a revalidate if the font changes
        // whereas the deprecated assignment to font that it replaces
        // does not
        setFont(localFont);//from  www .  j  ava2  s  . c  om
    }

    return localFont;
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.ColorFontFieldEditor.java

License:Open Source License

/**
 * /*from   w ww . j av  a 2 s  . co m*/
 * Updates the change font button and the previewer to reflect the
 * 
 * newly selected font.
 * 
 */

private void updateFont(FontData font[]) {
    FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, valueControl.getDisplay());

    // if we have nothing valid do as best we can
    if (bestFont == null)
        bestFont = getDefaultFontData();
    // Now cache this value in the receiver
    this.chosenFont = bestFont;
    if (valueControl != null) {
        if (fontRGB != null) {
            ColorRegistry registry = JFaceResources.getColorRegistry();
            Color color = registry.get(fontRGB.toString());
            if (color == null) {
                registry.put(fontRGB.toString(), fontRGB);
                color = registry.get(fontRGB.toString());
            }
            valueControl.setForeground(color);
        }
        valueControl.setText(StringConverter.asString(chosenFont[0]));
    }

    if (previewer != null) {
        previewer.setFont(bestFont);
    }
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.java

License:Open Source License

/**
 * Sets the default values of the preferences.
 *///from w ww .  j  av  a 2s  .co m
public static void initializeDefaults() {
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);

    store.setDefault(SHOW_INTRO_EDITOR, true);
    store.setDefault(USE_SYSTEM_COLORS, true);
    PreferenceConverter.setDefault(store, CANVAS_COLOR, new RGB(255, 255, 255));
    PreferenceConverter.setDefault(store, FIGURE_LABEL_FONT, f.getFontData());
    store.setDefault(LINE_WIDTH, 1);
    store.setDefault(LINE_ROUTING, getLineRoutingLabels()[0][1]);
    store.setDefault(SHOW_LINE_LABELS, true);
    PreferenceConverter.setDefault(store, LINE_COLOR, new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, LINE_LABEL_COLOR, new RGB(255, 255, 255));
    PreferenceConverter.setDefault(store, LINE_LABEL_FONT, f.getFontData());
    store.setDefault(SNAP_TO_GEOMETRY, true);
    store.setDefault(SNAP_TO_GRID, true);
    store.setDefault(GRID_WIDTH, 12);
    store.setDefault(GRID_HEIGHT, 12);
    PreferenceConverter.setDefault(store, GRID_COLOR, new RGB(230, 230, 230));
    store.setDefault(LABEL_PLACEMENT, LABEL_PLACEMENT_BOTTOM);
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.IconFigure.java

License:Open Source License

public Font getFont() {
    if (defaultFont == null) {
        defaultFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
    }//from w  w w. j a  va 2s.c o  m

    if (getLocalFont() == null) {
        // TODO: replaced a deprecated assignment to font
        // with this, but the behaviour is a little different
        setFont(defaultFont);
    }

    return getLocalFont();
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.TabbedTitleBarBorder.java

License:Open Source License

/**
 * @return Returns the font./*from  w  ww  . ja  va 2  s  . c  om*/
 */
public Font getFont() {
    if (font == null) {
        font = parent.getFont();
        if (font == null)
            font = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
    }
    return font;
}

From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.TitleBarButton.java

License:Open Source License

private void initialize() {
    setRequestFocusEnabled(true);/*from ww w .  j  a va 2  s .c  o  m*/
    setFocusTraversable(true);

    if (uncheckedImage != null) {
        org.eclipse.swt.graphics.Rectangle r = uncheckedImage.getBounds();
        setBounds(new Rectangle(0, 0, r.width, r.height));
        prefSize = new Dimension(r.width, r.height);
    } else {
        setForegroundColor(ColorConstants.black);
        setBackgroundColor(ColorConstants.white);
        calculatePreferredSize();
        setBounds(new Rectangle(0, 0, prefSize.width, prefSize.height));
    }
    setCursor(Cursors.ARROW);
    setBorder(null);
    setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));

    addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            setState(!state);
        }
    });
    this.addMouseMotionListener(new MouseMotionListener() {

        public void mouseDragged(MouseEvent me) {
            // TODO Auto-generated method stub

        }

        public void mouseEntered(MouseEvent me) {
            hilite = true;
            repaint();
        }

        public void mouseExited(MouseEvent me) {
            hilite = false;
            repaint();
        }

        public void mouseHover(MouseEvent me) {
            // TODO Auto-generated method stub

        }

        public void mouseMoved(MouseEvent me) {
            // TODO Auto-generated method stub

        }
    });
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);//w w w  .  java2s .c o  m
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandedComposites.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}