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.netxms.ui.eclipse.switchmanager.views.helpers.Dot1xPortListLabelProvider.java

License:Open Source License

@Override
public Font getFont(Object element, int columnIndex) {
    Dot1xPortSummary port = (Dot1xPortSummary) element;

    if ((port.getPaeState() == Interface.PAE_STATE_FORCE_UNAUTH)
            || (port.getPaeState() == Interface.PAE_STATE_HELD)
            || (port.getBackendState() == Interface.BACKEND_STATE_FAIL)
            || (port.getBackendState() == Interface.BACKEND_STATE_TIMEOUT)
            || (port.getPaeState() == Interface.PAE_STATE_CONNECTING))
        return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);

    return null;/*  ww  w.  j  ava  2s .c  o m*/
}

From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Return whether or not the dialog font is currently the same as the default font.
 * //from  w w  w  .  jav a 2 s .co m
 * @return boolean if the two are the same
 */
protected static boolean dialogFontIsDefault() {
    FontData[] dialogFontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT);
    FontData[] defaultFontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DEFAULT_FONT);
    return Arrays.equals(dialogFontData, defaultFontData);
}

From source file:org.org.eclipse.core.utils.platform.jobs.completion.CommonFonts.java

License:Open Source License

private static void init() {
    BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
    ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);

    Font defaultFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
    FontData[] defaultData = defaultFont.getFontData();
    if (defaultData != null && defaultData.length == 1) {
        FontData data = new FontData(defaultData[0].getName(), defaultData[0].getHeight(),
                defaultData[0].getStyle());

        if ("win32".equals(SWT.getPlatform())) {
            // NOTE: Windows only, for: data.data.lfStrikeOut = 1;
            try {
                Field dataField = data.getClass().getDeclaredField("data");
                Object dataObject = dataField.get(data);
                Class<?> clazz = dataObject.getClass().getSuperclass();
                Field strikeOutFiled = clazz.getDeclaredField("lfStrikeOut");
                strikeOutFiled.set(dataObject, (byte) 1);
                CommonFonts.STRIKETHROUGH = new Font(Display.getCurrent(), data);
            } catch (Throwable t) {
                // ignore
            }/*  w w  w . java  2 s.c o m*/
        }
    }
    if (CommonFonts.STRIKETHROUGH == null) {
        CommonFonts.HAS_STRIKETHROUGH = false;
        CommonFonts.STRIKETHROUGH = defaultFont;
    } else {
        CommonFonts.HAS_STRIKETHROUGH = true;
    }
}

From source file:org.polymap.core.mapeditor.tooling.edit.BaseLayerEditorTool.java

License:Open Source License

@Override
public void createPanelControl(Composite parent) {
    super.createPanelControl(parent);

    // layer(s)/*from  w ww . j  a va2s.  co m*/
    List<ILayer> selectableLayers = selectableLayers();
    layersList = getSite().getToolkit().createCombo(parent, labels(selectableLayers));
    layersList.setEditable(false);
    layersList.setVisibleItemCount(18);
    layersList.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    layoutControl(i18n("layerLabel"), layersList);

    // select layer item
    if (selectedLayer != null) {
        String[] items = layersList.getItems();
        for (int i = 0; i < items.length; i++) {
            if (items[i].equalsIgnoreCase(selectedLayer.getLabel())) {
                layersList.select(i);
            }
        }
    }

    layersList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent ev) {
            final String item = layersList.getItem(layersList.getSelectionIndex());
            AssocCollection<ILayer> layers = getSite().getEditor().getMap().getLayers();
            changeLayer(getFirst(filter(layers, Layers.hasLabel(item)), null));
        }
    });
}

From source file:org.polymap.core.mapeditor.tooling.edit.SelectLayerDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(i18n.get("title"));
    getShell().setMinimumSize(350, 230);
    getShell().pack();//  ww w.j  a v a2  s  .c  o m

    // client
    Composite client = (Composite) super.createDialogArea(parent);
    client.setLayout(FormLayoutFactory.defaults().margins(10).spacing(10).create());

    // msg
    Label msg = new Label(client, SWT.WRAP);
    msg.setLayoutData(FormDataFactory.filled().clearBottom().width(400).create());
    msg.setText(i18n.get("msg"));

    // layerCombo
    final CCombo layerCombo = new CCombo(client, SWT.BORDER);
    layerCombo.setLayoutData(FormDataFactory.filled().top(msg).clearBottom().create());
    layerCombo.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    layerCombo.setVisibleItemCount(12);
    layerCombo.setEditable(false);
    int i = 0;
    for (ILayer layer : layers) {
        layerCombo.add(layer.getLabel());
        if (layer == selectedLayer) {
            layerCombo.select(i);
        }
        i++;
    }
    layerCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent ev) {
            selectedLayer = layers.get(layerCombo.getSelectionIndex());
        }
    });

    //        // checkbox
    //        final Button hideCheck = new Button( client, SWT.CHECK );
    //        hideCheck.setLayoutData( FormDataFactory.filled().top( layerCombo ).left( 0, -5 ).clearBottom().create() );
    //        hideCheck.setText( i18n.get( "hide" ) );
    //        hideCheck.setSelection( "true".equals( memento.getString( PROP_HIDE_DIALOG ) ) );
    //        hideCheck.addSelectionListener( new SelectionAdapter() {
    //            @Override
    //            public void widgetSelected( SelectionEvent ev ) {
    //                memento.putString( PROP_HIDE_DIALOG, hideCheck.getSelection() ? "true" : "false" );
    //            }
    //        });

    // center dialog
    Rectangle shellBounds = getParentShell().getBounds();
    Point dialogSize = getShell().getSize();
    getShell().setLocation(shellBounds.x + (shellBounds.width - dialogSize.x) / 2,
            shellBounds.y + (shellBounds.height - dialogSize.y) / 2);

    return client;
}

From source file:org.polymap.openlayers.rap.widget.example.advanced.View.java

License:Open Source License

public void createPartControl(Composite parent) {
    display = parent.getDisplay();//from   www  . j av a 2s.c  o  m

    // setup bold font
    boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);

    Composite top = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    top.setLayout(layout);
    // top banner
    Composite banner = new Composite(top, SWT.NONE);
    banner.setLayoutData(
            new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
    layout = new GridLayout();
    layout.marginHeight = 5;
    layout.marginWidth = 10;
    layout.numColumns = 3;
    banner.setLayout(layout);

    open_add_wms_shell_btn = new Button(banner, SWT.PUSH);
    open_add_wms_shell_btn.setText("add WMS");

    open_add_wms_shell_btn.addMouseListener(this);

    open_set_center_btn = new Button(banner, SWT.PUSH);
    open_set_center_btn.setText("set Center");
    open_set_center_btn.addMouseListener(this);

    open_create_boxes_btn = new Button(banner, SWT.PUSH);
    open_create_boxes_btn.setText("add Boxes");
    open_create_boxes_btn.addMouseListener(this);

    /*
     * open_add_control_btn= new Button(banner,SWT.PUSH);
     * open_add_control_btn.setText("add Control");
     * open_add_control_btn.addMouseListener(this);
     */
    OpenLayersWidget widget = new OpenLayersWidget(top, SWT.MULTI | SWT.WRAP,
            "/js_lib/OpenLayers/OpenLayers.js");
    widget.setLayoutData(new GridData(GridData.FILL_BOTH));

    map = widget.getMap();

    // add some controls
    map.addControl(new LayerSwitcherControl());
    map.addControl(new MouseDefaultsControl());
    map.addControl(new KeyboardDefaultsControl());
    map.addControl(new PanZoomBarControl());
    map.addControl(new ScaleControl());
}

From source file:org.polymap.rhei.field.VerticalFieldLayout.java

License:Open Source License

@Override
public void createLayout(Composite parent, Map<Part, Control> parts) {
    parent.setLayout(new FormLayout());

    Control labelControl = parts.get(Part.Label);
    Control fieldControl = parts.get(Part.Field);
    Control decoControl = parts.get(Part.Decorator);

    FormDataFactory.on(labelControl).fill().noBottom();
    FormDataFactory.on(fieldControl).top(labelControl, spacing.get()).left(0).right(100, -19).width(50);
    FormDataFactory.on(decoControl).top(fieldControl, 0, Alignment.CENTER).left(fieldControl, 0).right(100);

    labelControl.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    parent.pack(true);//from   www.jav a  2s . c o  m
}

From source file:org.rssowl.ui.internal.editors.feed.BrowserBar.java

License:Open Source License

/**
 * @param feedView/*from  w  ww . j a v a2s . c o  m*/
 * @param parent
 */
public BrowserBar(FeedView feedView, Composite parent) {
    fFeedView = feedView;
    fParent = parent;
    fItalicFont = OwlUI.getItalic(JFaceResources.DEFAULT_FONT);

    createControl();
}

From source file:org.sf.feeling.swt.win32.extension.example.util.WidgetUtil.java

License:Open Source License

public static Label createBoldLabel(Composite parent, String text) {
    Label label = getToolkit().createLabel(parent, text);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    return label;
}

From source file:org.sf.feeling.swt.win32.extension.example.widget.TabbedPropertyTitle.java

License:Open Source License

/**
 * Constructor for TabbedPropertyTitle./*w w w.ja va2s. com*/
 * 
 * @param parent
 *            the parent composite.
 * @param factory
 *            the widget factory for the tabbed property sheet
 */
public TabbedPropertyTitle(Composite parent, FormWidgetFactory factory) {
    super(parent, SWT.NO_FOCUS);
    this.factory = factory;

    this.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            if (image == null && (text == null || text.equals(BLANK))) {
                label.setVisible(false);
            } else {
                label.setVisible(true);
                drawTitleBackground(e);
            }
        }
    });

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = ITabbedPropertyConstants.HSPACE + 6;
    layout.marginHeight = 5;
    setLayout(layout);

    label = factory.createCLabel(this, BLANK);
    label.setBackground(new Color[] { factory.getColors().getColor(FormColors.TB_BG),
            factory.getColors().getColor(FormColors.TB_GBG) }, new int[] { 100 }, true);

    if (bigFont == null) {
        Font font = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
        FontData fontData = font.getFontData()[0];
        fontData.setHeight(fontData.getHeight() + 1);
        bigFont = new Font(null, fontData);
    }
    label.setFont(bigFont);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
}