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

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

Introduction

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

Prototype

String DIALOG_FONT

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

Click Source Link

Document

The symbolic font name for the dialog font (value "org.eclipse.jface.dialogfont").

Usage

From source file:name.schedenig.eclipse.grepconsole.view.styles.StylePanel.java

License:Open Source License

/**
 * Initialises the GUI./*from  w w w.j a  va  2  s  .c  om*/
 */
private void init() {
    headerFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
    colorRegistry = new ColorRegistry(Activator.getDefault().getColorRegistry());

    new GridLayoutBuilder(this, 3, false).apply();

    labelName = new Label(this, SWT.NONE);
    labelName.setText(Messages.StylePanel_name);
    labelName.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    textName = new Text(this, SWT.BORDER);
    textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    panelCheckboxes = new Composite(this, SWT.NONE);
    RowLayout panelCheckboxesLayout = new RowLayout();
    panelCheckboxesLayout.marginWidth = panelCheckboxesLayout.marginHeight = 0;
    panelCheckboxesLayout.marginLeft = panelCheckboxesLayout.marginRight = 0;
    panelCheckboxesLayout.marginTop = panelCheckboxesLayout.marginBottom = 0;

    panelCheckboxes.setLayout(panelCheckboxesLayout);
    panelCheckboxes.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));

    cbBold = new Button(panelCheckboxes, SWT.CHECK);
    cbBold.setText(Messages.StylePanel_bold);
    cbBold.addSelectionListener(selectionListener);

    cbItalic = new Button(panelCheckboxes, SWT.CHECK);
    cbItalic.setText(Messages.StylePanel_italic);
    cbItalic.addSelectionListener(selectionListener);

    cpForeground = new ColorPickerLine(this);
    cpForeground.setText(Messages.StylePanel_foreground);
    cpForeground.setDialogTitle(Messages.StylePanel_title_foreground);
    cpForeground.addListener(colorChangeListener);

    cpBackground = new ColorPickerLine(this);
    cpBackground.setText(Messages.StylePanel_background);
    cpBackground.setDialogTitle(Messages.StylePanel_title_background);
    cpBackground.addListener(colorChangeListener);

    cpUnderline = new ColorPickerLine(this);
    cpUnderline.setText(Messages.StylePanel_underline);
    cpUnderline.setDialogTitle(Messages.StylePanel_title_underline);
    cpUnderline.setColorMandatory(false);
    cpUnderline.addListener(colorChangeListener);

    cpStrikethrough = new ColorPickerLine(this);
    cpStrikethrough.setText(Messages.StylePanel_strikethrough);
    cpStrikethrough.setDialogTitle(Messages.StylePanel_title_strikethrough);
    cpStrikethrough.setColorMandatory(false);
    cpStrikethrough.addListener(colorChangeListener);

    cpBorder = new ColorPickerLine(this);
    cpBorder.setText(Messages.StylePanel_border);
    cpBorder.setDialogTitle(Messages.StylePanel_title_border);
    cpBorder.setColorMandatory(false);
    cpBorder.addListener(colorChangeListener);

    labelPreview = new Label(this, SWT.NONE);
    labelPreview.setFont(headerFont);
    labelPreview.setText(Messages.StylePanel_preview);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    gridData.verticalIndent = 10;
    labelPreview.setLayoutData(gridData);

    final String unstyledText = Messages.StylePanel_unstyled_preview;
    final String styledText = Messages.StylePanel_styled_preview;

    stPreview = new StyledText(this, SWT.BORDER);
    stPreview.setText(unstyledText + "\n" + styledText + "\n" + unstyledText); //$NON-NLS-1$ //$NON-NLS-2$
    stPreview.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 3, 1));
    stPreview.setFont(JFaceResources.getTextFont());
    stPreview.setEditable(false);

    new PreviewColorHandler(stPreview);

    stPreview.addLineStyleListener(new LineStyleListener() {
        @Override
        public void lineGetStyle(LineStyleEvent event) {
            if (event.lineOffset == unstyledText.length() + 1) {
                StyleRange style = new StyleRange();
                style.start = event.lineOffset;
                style.length = event.lineText.length();
                fillStyleRange(style);
                event.styles = new StyleRange[] { style };
            }
        }
    });

    refresh();
}

From source file:net.enilink.komma.edit.ui.dialogs.FilteredTree.java

License:Open Source License

/**
 * Return a bold font if the given element matches the given pattern.
 * Clients can opt to call this method from a Viewer's label provider to get
 * a bold font for which to highlight the given element in the tree.
 * //from w w w .  j  av  a  2s  .co  m
 * @param element
 *            element for which a match should be determined
 * @param tree
 *            FilteredTree in which the element resides
 * @param filter
 *            PatternFilter which determines a match
 * 
 * @return bold font
 */
public static Font getBoldFont(Object element, FilteredTree tree, PatternFilter filter) {
    String filterText = tree.getFilterString();

    if (filterText == null) {
        return null;
    }

    // Do nothing if it's empty string
    String initialText = tree.getInitialText();
    if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$
        boolean initial = initialText != null && initialText.equals(filterText);
        if (initial) {
            filter.setPattern(null);
        } else if (filterText != null) {
            filter.setPattern(filterText);
        }

        if (filter.isElementVisible(tree.getViewer(), element)
                && filter.isLeafMatch(tree.getViewer(), element)) {
            return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
        }
    }
    return null;
}

From source file:net.refractions.udig.feature.editor.field.AttributeField.java

License:Open Source License

/**
 * Returns the symbolic font name used by this attribute field.
 * //from  w  w  w.j a va2 s .c o  m
 * @return the symbolic font name
 */
public String getFieldEditorFontName() {
    return JFaceResources.DIALOG_FONT;
}

From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java

License:Open Source License

/**
 * Creates the wizard's title area./*from   w  ww  .j  a  v a 2s  . c om*/
 * 
 * @param parent
 *            the SWT parent for the title area composite.
 * @return the created title area composite.
 */
protected Composite createTitleArea(Composite parent) {
    // Create the title area which will contain
    // a title, message, and image.
    int margins = 2;
    titleArea = new Composite(parent, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginHeight = 0;
    layout.marginWidth = margins;
    titleArea.setLayout(layout);

    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.verticalAlignment = SWT.TOP;
    titleArea.setLayoutData(layoutData);

    // Message label
    messageArea = new DialogMessageArea();
    messageArea.createContents(titleArea);

    titleArea.addControlListener(new ControlAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
         */
        @Override
        public void controlResized(ControlEvent e) {
            updateMessage();
        }
    });

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty()))
                updateMessage();
            if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                updateMessage();
                Font dialogFont = JFaceResources.getDialogFont();
                updateTreeFont(dialogFont);
                Control[] children = ((Composite) buttonBar).getChildren();
                for (int i = 0; i < children.length; i++)
                    children[i].setFont(dialogFont);
            }
        }
    };

    titleArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });
    JFaceResources.getFontRegistry().addListener(fontListener);
    messageArea.setTitleLayoutData(createMessageAreaData());
    messageArea.setMessageLayoutData(createMessageAreaData());
    return titleArea;
}

From source file:net.tourbook.chart.ToolTipV1.java

License:Open Source License

void toolTip_10_Show(final int x, final int y, final int hoveredBarSerieIndex, final int hoveredBarValueIndex) {

    _hoveredBarSerieIndex = hoveredBarSerieIndex;
    _hoveredBarValueIndex = hoveredBarValueIndex;

    if (_toolTipShell == null) {

        _toolTipShell = new Shell(_chart.getShell(), SWT.ON_TOP | SWT.TOOL);

        final Display display = _toolTipShell.getDisplay();
        final Color infoColorBackground = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
        final Color infoColorForeground = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);

        _toolTipContainer = new Composite(_toolTipShell, SWT.NONE);
        GridLayoutFactory.fillDefaults().extendedMargins(2, 5, 2, 3).applyTo(_toolTipContainer);
        _toolTipContainer.setBackground(infoColorBackground);
        _toolTipContainer.setForeground(infoColorForeground);
        {/* www  .j  a  v  a2s . c  o m*/
            _toolTipTitle = new Label(_toolTipContainer, SWT.LEAD);
            _toolTipTitle.setBackground(infoColorBackground);
            _toolTipTitle.setForeground(infoColorForeground);
            _toolTipTitle.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

            _toolTipLabel = new Label(_toolTipContainer, SWT.LEAD | SWT.WRAP);
            _toolTipLabel.setBackground(infoColorBackground);
            _toolTipLabel.setForeground(infoColorForeground);
        }

        for (final int toolTipEvent : _toolTipEvents) {
            _chart.addListener(toolTipEvent, _toolTipListener);
        }
    }

    if (toolTip_30_Update(x, y)) {
        _toolTipShell.setVisible(true);
    } else {
        toolTip_20_Hide();
    }
}

From source file:net.tourbook.map2.view.WayPointToolTipProvider.java

License:Open Source License

@Override
public Composite createToolTipContentArea(final Event event, final Composite parent) {

    if (_hoveredWayPoint == null) {
        // this case should not happen
        return null;
    }//from www  . java2 s  .  c o m

    final Display display = parent.getDisplay();

    _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    return createUI(parent);
}

From source file:net.tourbook.map3.ui.DialogLayerViewerToolTip.java

License:Open Source License

public DialogLayerViewerToolTip(final ContainerCheckedTreeViewer propViewer) {

    super(propViewer.getTree());

    _propViewer = propViewer;//from   w  w w .  j  av  a 2s.  c o m

    _tree = propViewer.getTree();
    _tree.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            onDispose();
        }
    });

    final Device display = _tree.getDisplay();

    _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
}

From source file:net.tourbook.map3.ui.SlideoutMap3LayerTooltip.java

License:Open Source License

public SlideoutMap3LayerTooltip(final ContainerCheckedTreeViewer layerViewer) {

    super(layerViewer.getTree());

    _layerViewer = layerViewer;/*from  w  ww . j a  v  a  2 s  .  c  o m*/
    _tree = _layerViewer.getTree();

    final Device display = _tree.getDisplay();

    _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    _cursorHand = new Cursor(display, SWT.CURSOR_HAND);

}

From source file:net.tourbook.mapping.WayPointToolTipProvider.java

License:Open Source License

public Composite createToolTipContentArea(final Event event, final Composite parent) {

    if (_hoveredWayPoint == null) {
        // this case should not happen
        return null;
    }/* w ww . j av a2  s .  c  o m*/

    final Display display = parent.getDisplay();

    _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    return createUI(parent);
}

From source file:net.tourbook.preferences.PrefPagePeople.java

License:Open Source License

private void initUI(final Composite parent) {

    initializeDialogUnits(parent);/*from ww  w  .j  av a2 s . c  om*/

    _fontItalic = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);

    _defaultSelectionListener = new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            onModifyPerson();
        }
    };

    _defaultModifyListener = new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            onModifyPerson();
        }
    };

    _hrZoneMouseListener = new MouseListener() {

        @Override
        public void mouseDoubleClick(final MouseEvent e) {
            onEditHrZones();
        }

        @Override
        public void mouseDown(final MouseEvent e) {
        }

        @Override
        public void mouseUp(final MouseEvent e) {
        }
    };

    createDeviceList();
}