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

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

Introduction

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

Prototype

String DEFAULT_FONT

To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.

Click Source Link

Document

The symbolic font name for the standard font (value "org.eclipse.jface.defaultfont").

Usage

From source file:org.xmind.ui.internal.properties.MindMapPropertySheetPage.java

License:Open Source License

private void createResetStyleControl(WidgetFactory widgetFactory, Composite parent) {
    resetStyleControl = widgetFactory.createHyperlink(parent,
            MindMapMessages.MindMapPropertySheetPage_ResetStyle_text, SWT.NONE);
    resetStyleControl.setUnderlined(false);
    resetStyleControl.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
    resetStyleControl.addHyperlinkListener(new IHyperlinkListener() {

        public void linkExited(HyperlinkEvent e) {
            resetStyleControl.setUnderlined(false);
        }/*  w  ww  .j av a2 s  .  c  o m*/

        public void linkEntered(HyperlinkEvent e) {
            resetStyleControl.setUnderlined(true);
        }

        public void linkActivated(HyperlinkEvent e) {
            resetStyles();
        }
    });
    resetStyleControl.setFont(FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, -1));
    resetStyleControl.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE));
}

From source file:org.xmind.ui.internal.sharing.LocalNetworkSharingPrefPage.java

License:Open Source License

private void fillStatusSection(Composite parent) {
    Label titleLabel = new Label(parent, SWT.NONE);
    titleLabel.setLayoutData(new GridData(SWT.END, SWT.BEGINNING, false, false));
    titleLabel.setFont(JFaceResources.getDefaultFont());
    titleLabel.setText(SharingMessages.PreferencePage_Form_Status_label);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 0;//from   w  w  w.  j a v a2s . c om
    layout.marginHeight = 0;
    layout.verticalSpacing = 5;
    layout.horizontalSpacing = 5;
    composite.setLayout(layout);

    Composite statusComposite = new Composite(composite, SWT.NONE);
    statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    GridLayout statusLayout = new GridLayout(2, false);
    statusLayout.marginWidth = 0;
    statusLayout.marginHeight = 0;
    statusLayout.verticalSpacing = 5;
    statusLayout.horizontalSpacing = 5;
    statusComposite.setLayout(statusLayout);

    statusLabel = new Label(statusComposite, SWT.LEFT);
    statusLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, true));
    statusLabel.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT));
    statusLabel.setText(""); //$NON-NLS-1$

    Composite noBonjourWidget = new Composite(statusComposite, SWT.NONE);
    this.noBonjourWidget = noBonjourWidget;
    noBonjourWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    GridLayout noBonjourLayout = new GridLayout(2, false);
    noBonjourLayout.marginWidth = 0;
    noBonjourLayout.marginHeight = 0;
    noBonjourLayout.verticalSpacing = 3;
    noBonjourLayout.horizontalSpacing = 3;
    noBonjourWidget.setLayout(noBonjourLayout);

    Label noBonjourWarningImage = new Label(noBonjourWidget, SWT.NONE);
    noBonjourWarningImage.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
    noBonjourWarningImage
            .setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK));

    Label noBonjourWarningLabel = new Label(noBonjourWidget, SWT.WRAP);
    noBonjourWarningLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
    noBonjourWarningLabel.setText(SharingMessages.PreferencePage_Form_Status_DisplayArea_NoBonjour_warningText);

    changeStatusButton = new Button(composite, SWT.PUSH | SWT.CENTER);
    changeStatusButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
    changeStatusButton.setText(""); //$NON-NLS-1$
    changeStatusButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            changeServiceStatus();
        }
    });
}

From source file:org.xmind.ui.internal.sharing.SharedMapLabelProvider.java

License:Open Source License

public Font getFont(Object element) {
    return FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, Util.isMac() ? -2 : -1);
}

From source file:org.xmind.ui.internal.sharing.SharedMapLabelProvider.java

License:Open Source License

public IFigure getToolTipFigure(Object element) {
    if (element instanceof ISharedMap) {
        ISharedMap map = (ISharedMap) element;
        if (map.getSharedLibrary().isLocal() && map instanceof ILocalSharedMap) {
            ILocalSharedMap localMap = (ILocalSharedMap) map;
            String path = localMap.getResourcePath();
            long modifiedTime = localMap.getResourceModifiedTime();
            long addedTime = localMap.getAddedTime();
            boolean missing = localMap.isMissing();

            IFigure tooltip = new Figure();
            ToolbarLayout layout = new ToolbarLayout(false);
            layout.setSpacing(1);/*from  w w  w .ja va  2 s . c o m*/
            tooltip.setLayoutManager(layout);
            if (missing) {
                Label statusFigure = new Label(SharingMessages.SharedMap_tooltip_MapIsMissing_warningText);
                statusFigure.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT));
                tooltip.add(statusFigure);
            }

            Label pathLabel = new Label(path);
            pathLabel.setFont(JFaceResources.getDefaultFont());
            tooltip.add(pathLabel);

            IFigure attrsFigure = new Figure();
            attrsFigure.setBorder(new MarginBorder(7, 0, 0, 0));
            ToolbarLayout attrLayout = new ToolbarLayout(false);
            attrLayout.setSpacing(1);
            attrsFigure.setLayoutManager(attrLayout);
            Font attrFont = FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, -2);
            Label addedLabel = new Label(
                    NLS.bind(SharingMessages.SharedMap_tooltip_AddedTime_text_withTime, formatTime(addedTime)));
            addedLabel.setFont(attrFont);
            attrsFigure.add(addedLabel);
            if (!missing) {
                Label modifiedLabel = new Label(
                        NLS.bind(SharingMessages.SharedMap_tooltip_ModifiedTime_text_withTime,
                                formatTime(modifiedTime)));
                modifiedLabel.setFont(attrFont);
                attrsFigure.add(modifiedLabel);
            }
            tooltip.add(attrsFigure);
            return tooltip;
        }
    }
    return null;
}

From source file:org.xmind.ui.internal.sharing.SharedMapsDropSupport.java

License:Open Source License

private void showToolTip(int x, int y) {
    if (tooltip == null || tooltip.isDisposed()) {
        tooltip = new Shell(control.getShell(), SWT.TOOL);
        tooltip.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
        tooltip.setAlpha(128);//from  w w  w  .j  a  va  2 s . co m
        GridLayout layout = new GridLayout(1, false);
        layout.marginWidth = 5;
        layout.marginHeight = 5;
        layout.verticalSpacing = 0;
        layout.horizontalSpacing = 0;
        tooltip.setLayout(layout);

        tooltip.setLayout(layout);
        Label label = new Label(tooltip, SWT.CENTER | SWT.WRAP);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
        label.setText(SharingMessages.SharedMapsDropSupport_DropToShare_toolTip);
        label.setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, 14));
        label.setBackground(label.getParent().getBackground());
        label.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        tooltip.pack(true);
        tooltip.setVisible(true);
        Listener motionListener = new Listener() {
            public void handleEvent(Event event) {
                hideToolTip();
            }
        };
        tooltip.addListener(SWT.MouseEnter, motionListener);
        tooltip.addListener(SWT.MouseExit, motionListener);
        tooltip.addListener(SWT.MouseMove, motionListener);
    }
    Point size = tooltip.getSize();
    tooltip.setLocation(x - size.x / 2, y - size.y - 20);
}

From source file:org.xmind.ui.internal.views.WorkbookRevisionsPage.java

License:Open Source License

private void fillOptions(Composite parent) {
    //        titleLabel = new Label(parent, SWT.NONE);
    //        titleLabel.setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT,
    //                11));
    //        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
    //        titleLabel.setLayoutData(layoutData);

    autoSaveOption = new Button(parent, SWT.CHECK | SWT.WRAP);
    autoSaveOption.setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, -1));
    autoSaveOption.setText(MindMapMessages.WorkbookRevisionsPage_AutoSaveRevisionsCheck_text);
    autoSaveOption.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}

From source file:org.xmind.ui.resources.FontUtils.java

License:Open Source License

/**
 * Parses a description to a set of font data.
 * /*  ww  w  . j  a  va 2s.  c o  m*/
 * @param string
 *            a string of the description of a set of font data, e.g.
 *            "(Arial,12,bi)"
 * @return
 */
public static FontData[] toFontData(String string) {
    if (string == null)
        return null;

    string = string.trim();
    if (string.startsWith("(") && string.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$
        String[] eles = string.substring(1, string.length() - 1).split(","); //$NON-NLS-1$
        if (eles.length > 0) {
            String name = eles[0].trim();
            if ("".equals(name)) { //$NON-NLS-1$
                name = JFaceResources.getFontRegistry().getFontData(JFaceResources.DEFAULT_FONT)[0].getName();
            }

            int size = -1;
            if (eles.length > 1) {
                try {
                    size = Integer.parseInt(eles[1].trim());
                } catch (Exception e) {
                }
            }
            if (size < 0) {
                size = JFaceResources.getFontRegistry().getFontData(JFaceResources.DEFAULT_FONT)[0].getHeight();
            }

            int style = -1;
            if (eles.length > 2) {
                style = SWT.NORMAL;
                String styles = eles[2].trim().toLowerCase();
                if (!"".equals(styles)) { //$NON-NLS-1$
                    if (styles.indexOf('b') >= 0)
                        style |= SWT.BOLD;
                    if (styles.indexOf('i') >= 0)
                        style |= SWT.ITALIC;
                }
            }
            if (style < 0) {
                style = JFaceResources.getFontRegistry().getFontData(JFaceResources.DEFAULT_FONT)[0].getStyle();
            }
            FontData[] fontData = new FontData[] { new FontData(name, size, style) };
            return fontData;
        }
    }
    return null;
}

From source file:org.xmind.ui.resources.FontUtils.java

License:Open Source License

private static boolean isDefaultKey(String key) {
    return JFaceResources.DEFAULT_FONT.equals(key) || JFaceResources.DIALOG_FONT.equals(key)
            || JFaceResources.HEADER_FONT.equals(key) || JFaceResources.TEXT_FONT.equals(key)
            || JFaceResources.BANNER_FONT.equals(key);
}

From source file:org.xwiki.eclipse.adapters.XWikiConnectionAdapter.java

License:Open Source License

public FontData getFont(Object element) {
    if (element instanceof IXWikiConnection) {
        IXWikiConnection xwikiConnection = (IXWikiConnection) element;

        if (xwikiConnection.isConnected()) {
            return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT).getFontData()[0];
        }//w  w  w  .  j  a  v a  2 s.  c o  m
    }

    return null;
}

From source file:org.xwiki.eclipse.ui.adapters.DataManagerAdapter.java

License:Open Source License

@Override
public FontData getFont(Object object) {
    if (object instanceof DataManager) {
        DataManager dataManager = (DataManager) object;

        if (dataManager.isConnected()) {
            return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT).getFontData()[0];
        }/*  w w  w .  j a  v  a  2s.  com*/
    }

    return super.getFont(object);
}