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:de.loskutov.bco.preferences.SupportPanel.java

License:Open Source License

static void createSupportLinks(Composite defPanel) {
    Group commonPanel = new Group(defPanel, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//from www.  j  av  a2 s  . co m
    layout.marginWidth = 0;
    commonPanel.setLayout(layout);
    commonPanel.setLayoutData(gridData);
    String pluginName = "BytecodeOutline";
    commonPanel.setText("Support " + pluginName + " plugin and get support too :-)");

    Label label = new Label(commonPanel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Feel free to support " + pluginName + " plugin in the way you like:");

    Font font = JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDialogFont().getFontData()[0].getName());

    Link link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>visit homepage</a>");
    link.setToolTipText("You need just a sense of humor!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://andrei.gmxhome.de/bytecode");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>report issue or feature request</a>");
    link.setToolTipText("You need a valid account at ow2.org!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://forge.ow2.org/tracker/?group_id=23");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
    link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://marketplace.eclipse.org/content/bytecode-outline");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>make a donation to support plugin development</a>");
    link.setToolTipText("You do NOT need a PayPal account!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
        }
    });
}

From source file:de.loskutov.bco.views.HelpUtils.java

License:Open Source License

/**
 * From {@link JavadocHover} class: returns the Javadoc hover style sheet with the
 * current Javadoc font from the preferences.
 * @return the updated style sheet/*  ww  w. ja  v a  2  s  . c o  m*/
 */
public static String getHelpStyleSheet() {
    if (styleSheet == null) {
        styleSheet = loadStyleSheet();
    }
    String css = styleSheet;
    if (css == null || css.isEmpty()) {
        return "";
    }
    FontData fontData = JFaceResources.getFontRegistry()
            .getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0];
    css = HTMLPrinter.convertTopLevelFont(css, fontData);
    StringBuilder sb = new StringBuilder(css);
    sb.append("\nbody {  background-color:");
    appendColor(sb, bg_color_rgb);
    sb.append(";  color:");
    appendColor(sb, fg_color_rgb);
    sb.append(";  }\n");
    return sb.toString();
}

From source file:de.loskutov.dh.preferences.SupportPanel.java

License:Open Source License

static void createSupportLinks(Composite defPanel) {
    Group commonPanel = new Group(defPanel, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*www .  j a v  a2 s .  c o  m*/
    layout.marginWidth = 0;
    commonPanel.setLayout(layout);
    commonPanel.setLayoutData(gridData);
    commonPanel.setText("Support DataHierarchy plugin and get support too :-)");

    Label label = new Label(commonPanel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Feel free to support DataHierarchy plugin in the way you like:");

    Font font = JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDialogFont().getFontData()[0].getName());

    Link link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>visit homepage</a>");
    link.setToolTipText("You need just a sense of humor!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://andrei.gmxhome.de/datahierarchy");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>report issue or feature request</a>");
    link.setToolTipText("You need a valid google account at google.com!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("https://github.com/iloveeclipse/datahierarchy/issues");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your Openhub software stack</a>");
    link.setToolTipText("You need a valid Ohloh account at ohloh.net!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("https://www.openhub.net/p/DataHierarchy");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
    link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://marketplace.eclipse.org/content/data-hierarchy");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>make a donation to support plugin development</a>");
    link.setToolTipText("You do NOT need a PayPal account!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
        }
    });
}

From source file:de.loskutov.eclipse.jdepend.preferences.SupportPanel.java

License:Open Source License

static void createSupportLinks(Composite defPanel) {
    Group commonPanel = new Group(defPanel, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*from   w w w. j ava 2 s .  c o m*/
    layout.marginWidth = 0;
    commonPanel.setLayout(layout);
    commonPanel.setLayoutData(gridData);
    commonPanel.setText("Support JDepend4Eclipse plugin and get support too :-)");

    Label label = new Label(commonPanel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Feel free to support JDepend4Eclipse plugin in the way you like:");

    Font font = JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDialogFont().getFontData()[0].getName());

    Link link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>visit homepage</a>");
    link.setToolTipText("You need just a sense of humor!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://andrei.gmxhome.de/jdepend4eclipse");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>report issue or feature request</a>");
    link.setToolTipText("You need a valid google account at google.com!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://code.google.com/a/eclipselabs.org/p/jdepend4eclipse/issues/list");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your Ohloh software stack</a>");
    link.setToolTipText("You need a valid Ohloh account at ohloh.net!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://www.ohloh.net/p/jdepend4eclipse");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
    link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://marketplace.eclipse.org/content/jdepend4eclipse");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>make a donation to support plugin development</a>");
    link.setToolTipText("You do NOT need a PayPal account!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
        }
    });
}

From source file:de.loskutov.eclipseskins.preferences.SupportPanel.java

License:Open Source License

static void createSupportLinks(Composite defPanel) {
    Group commonPanel = new Group(defPanel, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*  w ww. j ava2  s.c  o  m*/
    layout.marginWidth = 0;
    commonPanel.setLayout(layout);
    commonPanel.setLayoutData(gridData);
    commonPanel.setText("Support Extended VS Presentation plugin and get support too :-)");

    Label label = new Label(commonPanel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Feel free to support Extended VS Presentation plugin in the way you like:");

    Font font = JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDialogFont().getFontData()[0].getName());

    Link link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>visit homepage</a>");
    link.setToolTipText("You need just a sense of humor!");
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUrlClick("http://andrei.gmxhome.de/skins");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>report issue or feature request</a>");
    link.setToolTipText("You need a valid google account at google.com!");
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUrlClick("http://code.google.com/a/eclipselabs.org/p/skin4eclipse/issues/list");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your Ohloh software stack</a>");
    link.setToolTipText("You need a valid Ohloh account at ohloh.net!");
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUrlClick("http://www.ohloh.net/p/skin4eclipse");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
    link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUrlClick("http://marketplace.eclipse.org/content/extended-vs-presentation");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>make a donation to support plugin development</a>");
    link.setToolTipText("You do NOT need a PayPal account!");
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUrlClick(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
        }
    });
}

From source file:de.loskutov.fs.properties.SupportPanel.java

License:Open Source License

static void createSupportLinks(Composite defPanel) {
    Group commonPanel = new Group(defPanel, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*from  ww  w  . jav  a 2  s.  c  o  m*/
    layout.marginWidth = 0;
    commonPanel.setLayout(layout);
    commonPanel.setLayoutData(gridData);
    commonPanel.setText("Support FileSync plugin and get support too :-)");

    Label label = new Label(commonPanel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Feel free to support FileSync plugin in the way you like:");

    Font font = JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDialogFont().getFontData()[0].getName());

    Link link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>visit homepage</a>");
    link.setToolTipText("You need just a sense of humor!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://andrei.gmxhome.de/filesync");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>report issue or feature request</a>");
    link.setToolTipText("You need a valid google account at google.com!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://code.google.com/a/eclipselabs.org/p/filesync4eclipse/issues/list");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your Ohloh software stack</a>");
    link.setToolTipText("You need a valid Ohloh account at ohloh.net!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://www.ohloh.net/p/filesync4eclipse");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
    link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick("http://marketplace.eclipse.org/content/filesync");
        }
    });

    link = new Link(commonPanel, SWT.NONE);
    link.setFont(font);
    link.setText(" - <a>make a donation to support plugin development</a>");
    link.setToolTipText("You do NOT need a PayPal account!");
    link.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            handleUrlClick(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
        }
    });
}

From source file:de.walware.ecommons.ui.components.WidgetToolsButton.java

License:Open Source License

static Font getToolButtonFont() {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (!fontRegistry.hasValueFor(FONT_SYMBOLIC_NAME)) {
        fontRegistry.addListener(new IPropertyChangeListener() {
            @Override/*from www  .  ja  va  2s. co m*/
            public void propertyChange(final PropertyChangeEvent event) {
                if (event.getProperty().equals(JFaceResources.DIALOG_FONT)) {
                    updateFont();
                }
            }
        });
        updateFont();
    }
    return fontRegistry.get(FONT_SYMBOLIC_NAME);
}

From source file:de.walware.ecommons.ui.components.WidgetToolsButton.java

License:Open Source License

private static void updateFont() {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    final Font dialogFont = fontRegistry.get(JFaceResources.DIALOG_FONT);
    final int size = 1 + Math.max(dialogFont.getFontData()[0].getHeight() * 3 / 5, 6);
    final FontDescriptor descriptor = fontRegistry.getDescriptor(JFaceResources.TEXT_FONT).setHeight(size);
    final Font toolFont = descriptor.createFont(Display.getCurrent());
    fontRegistry.put(FONT_SYMBOLIC_NAME, toolFont.getFontData());
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

private static DialogValues getDialogValues() {
    if (gDialogValues == null) {
        JFaceResources.getFontRegistry().addListener(new IPropertyChangeListener() {
            @Override//from   w w w. j  a v  a2  s.  co  m
            public void propertyChange(final PropertyChangeEvent event) {
                if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                    UIAccess.getDisplay().asyncExec(new Runnable() {
                        @Override
                        public void run() {
                            gDialogValues = new DialogValues();
                        }
                    });
                }
            }
        });
        gDialogValues = new DialogValues();
    }
    return gDialogValues;
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Button button) {
    button.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));
    final PixelConverter converter = new PixelConverter(button);
    final int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}