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

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

Introduction

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

Prototype

public static Font getBannerFont() 

Source Link

Document

Returns the JFace's banner font.

Usage

From source file:net.sf.eclipsensis.dialogs.NSISAboutDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    final Display display = getShell().getDisplay();
    Color background = JFaceColors.getBannerBackground(display);
    Color foreground = JFaceColors.getBannerForeground(display);

    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(background);
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);/*from  www. ja v  a 2  s .c  o  m*/

    Label label = new Label(composite, SWT.LEFT);
    label.setBackground(background);
    label.setForeground(foreground);
    label.setFont(JFaceResources.getBannerFont());
    if (NSISPreferences.getInstance().getNSISHome() != null) {
        StringBuffer buf = new StringBuffer(cAboutHeader).append(INSISConstants.LINE_SEPARATOR);
        buf.append(EclipseNSISPlugin.getFormattedString("about.header.format", //$NON-NLS-1$
                new Object[] { EclipseNSISPlugin.getResourceString("makensis.display.name"), //$NON-NLS-1$
                        NSISPreferences.getInstance().getNSISHome().getNSISExe().getVersion().toString() }));
        label.setText(buf.toString());
    } else {
        label.setText(cAboutHeader);
    }
    GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    data.horizontalSpan = 1;
    label.setLayoutData(data);

    label = new Label(composite, SWT.CENTER);
    label.setBackground(background);
    label.setForeground(foreground);
    label.setImage(cAboutImage);
    data = new GridData(SWT.END, SWT.BEGINNING, false, false);
    data.horizontalSpan = 1;
    label.setLayoutData(data);

    Link link = new Link(composite, SWT.WRAP);
    data = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
    data.horizontalSpan = 2;
    data.widthHint = convertWidthInCharsToPixels(80);
    link.setLayoutData(data);
    link.setBackground(background);
    link.setText(cAboutText);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            openLink(e.text);
        }
    });

    label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    return composite;
}

From source file:net.sf.eclipsensis.installoptions.wizard.InstallOptionsWizardPage.java

License:Open Source License

/** (non-Javadoc)
 * Method declared on IDialogPage./*from   ww  w .ja v  a2 s.c o  m*/
 */
public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    setControl(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IInstallOptionsConstants.PLUGIN_CONTEXT_PREFIX + "installoptions_wizard_context"); //$NON-NLS-1$

    final GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);
    final Label l = NSISWizardDialogUtil.createLabel(composite,
            InstallOptionsPlugin.getResourceString("wizard.page.header"), true, null, false); //$NON-NLS-1$
    l.setFont(JFaceResources.getBannerFont());
    l.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label l2 = NSISWizardDialogUtil.createLabel(composite,
            InstallOptionsPlugin.getResourceString("wizard.page.text"), true, null, false); //$NON-NLS-1$
    final GridData gridData = (GridData) l2.getLayoutData();
    Dialog.applyDialogFont(l2);
    gridData.widthHint = Common.calculateControlSize(l2, 80, 0).x;

    createTemplatesGroup(composite);

    createScriptSaveSettingsGroup(composite);

    composite.addListener(SWT.Resize, new Listener() {
        boolean init = false;

        public void handleEvent(Event e) {
            if (init) {
                Point size = composite.getSize();
                gridData.widthHint = size.x - 2 * layout.marginWidth;
                composite.layout();
            } else {
                init = true;
            }
        }
    });

    NSISWizardDialogUtil.createRequiredFieldsLabel(composite);
    setPageComplete(validatePage());
}

From source file:net.sf.eclipsensis.wizard.NSISWizardWelcomePage.java

License:Open Source License

@Override
protected Control createPageControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);

    final GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);/*w w w .  ja v  a2 s .c o m*/

    final Label header = NSISWizardDialogUtil.createLabel(composite, "wizard.welcome.header", true, null, //$NON-NLS-1$
            false);
    header.setFont(JFaceResources.getBannerFont());
    header.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label text = NSISWizardDialogUtil.createLabel(composite, "wizard.welcome.text", true, null, false); //$NON-NLS-1$
    final GridData gridData = (GridData) text.getLayoutData();
    Dialog.applyDialogFont(text);
    gridData.widthHint = Common.calculateControlSize(text, 80, 0).x;

    createTemplatesGroup(composite);

    composite.addListener(SWT.Resize, new Listener() {
        boolean init = false;

        public void handleEvent(Event e) {
            if (init) {
                Point size = composite.getSize();
                gridData.widthHint = size.x - 2 * layout.marginWidth;
                composite.layout();
            } else {
                init = true;
            }
        }
    });

    validatePage(1);

    return composite;
}

From source file:net.sourceforge.eclipsetrader.core.ui.PluginPreferencePage.java

License:Open Source License

/**
 * Creates a composite with a highlighted Note entry and a message text.
 * This is designed to take up the full width of the page.
 * /*from  w w w .j  av a 2 s.c  om*/
 * @param font the font to use
 * @param composite the parent composite
 * @param title the title of the note
 * @param message the message for the note
 * @return the composite for the note
 */
protected Composite createNoteComposite(Font font, Composite composite, String title, String message) {
    Composite messageComposite = new Composite(composite, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageComposite.setLayout(messageLayout);
    messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    messageComposite.setFont(font);

    final Label noteLabel = new Label(messageComposite, SWT.BOLD);
    noteLabel.setText(title);
    noteLabel.setFont(JFaceResources.getBannerFont());
    noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
                noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
            }
        }
    };
    JFaceResources.getFontRegistry().addListener(fontListener);
    noteLabel.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });

    Label messageLabel = new Label(messageComposite, SWT.WRAP);
    messageLabel.setText(message);
    messageLabel.setFont(font);
    return messageComposite;
}

From source file:net.tourbook.common.tooltip.AdvancedSlideout.java

License:Open Source License

private void createUI_12_ActionBar_Draggable(final Composite container) {

    _labelDragSlideout = new Label(container, SWT.NONE);
    GridDataFactory.fillDefaults()//
            .grab(true, false).align(SWT.FILL, SWT.CENTER)
            //            .indent(3, 0)
            .applyTo(_labelDragSlideout);
    _labelDragSlideout.setText(_draggerText);
    _labelDragSlideout.setToolTipText(Messages.Slideout_Dialog_Action_DragSlideout_ToolTip);
    _labelDragSlideout.setFont(JFaceResources.getBannerFont());
    //      _labelDragSlideout.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA));

    _labelDragSlideout.addMouseTrackListener(new MouseTrackListener() {

        @Override/*from   ww w . j  ava  2 s.c  o m*/
        public void mouseEnter(final MouseEvent e) {
            _labelDragSlideout.setCursor(_cursorHand);
        }

        @Override
        public void mouseExit(final MouseEvent e) {
            _labelDragSlideout.setCursor(null);
        }

        @Override
        public void mouseHover(final MouseEvent e) {

        }
    });

    _labelDragSlideout.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(final MouseEvent e) {
            onMouseDown(e);
        }

        @Override
        public void mouseUp(final MouseEvent e) {
            onMouseUp(e);
        }
    });
    _labelDragSlideout.addMouseMoveListener(new MouseMoveListener() {
        @Override
        public void mouseMove(final MouseEvent e) {
            onMouseMove(e);
        }
    });
}

From source file:net.tourbook.conconi.SlideoutConconiOptions.java

License:Open Source License

private void createUI_10_Title(final Composite parent) {

    /*//from w  w  w  .j  a v a 2  s .com
     * Label: Slideout title
     */
    final Label label = new Label(parent, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(label);
    label.setText(Messages.Slideout_ConconiOptions_Label_Title);
    label.setFont(JFaceResources.getBannerFont());
}

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

License:Open Source License

private void createUI_000_ConfigurationName(final Composite parent) {

    /*//from www  .  j a v  a  2 s .com
     * Label: Title
     */
    final Label title = new Label(parent, SWT.LEAD);
    GridDataFactory.fillDefaults()//
            .grab(true, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(title);
    title.setFont(JFaceResources.getBannerFont());
    title.setText(Messages.TourTrack_Properties_Label_ConfigName);
    title.setToolTipText(Messages.TourTrack_Properties_Label_ConfigName_Tooltip);

    final Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);
    {

        /*
         * Combo: Configutation
         */
        _comboName = new Combo(container, SWT.READ_ONLY | SWT.BORDER);
        GridDataFactory.fillDefaults().grab(true, false).align(SWT.BEGINNING, SWT.CENTER)
                // this is too small in linux
                //               .hint(_pc.convertHorizontalDLUsToPixels(15 * 4), SWT.DEFAULT)
                .applyTo(_comboName);
        _comboName.setVisibleItemCount(20);
        _comboName.addFocusListener(_keepOpenListener);
        _comboName.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                onSelectConfig();
            }
        });

        /*
         * Button: Reset
         */
        _btnReset = new Button(container, SWT.PUSH);
        GridDataFactory.fillDefaults()//
                .align(SWT.END, SWT.CENTER).applyTo(_btnReset);
        _btnReset.setText(Messages.TourTrack_Properties_Button_Default);
        _btnReset.setToolTipText(Messages.TourTrack_Properties_Button_Default_Tooltip);
        _btnReset.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                onSelectDefaultConfig(e);
            }
        });
    }
}

From source file:net.tourbook.statistic.SlideoutStatisticOptions.java

License:Open Source License

private void createUI_10_Title(final Composite parent) {

    /*//w w  w . j  a  v  a  2 s  .  c  o m
     * Label: Slideout title
     */
    final Label label = new Label(parent, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(label);
    label.setText(Messages.Slideout_StatisticOptions_Label_Title);
    label.setFont(JFaceResources.getBannerFont());
}

From source file:net.tourbook.training.SlideoutTrainingOptions.java

License:Open Source License

private void createUI_10_Title(final Composite parent) {

    /*/*from   www  . ja v  a 2s  . c  om*/
     * Label: Slideout title
     */
    final Label label = new Label(parent, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(label);
    label.setText(Messages.Slideout_TrainingOptions_Label_Title);
    label.setFont(JFaceResources.getBannerFont());
}

From source file:net.tourbook.ui.tourChart.SlideoutGraphMinMax.java

License:Open Source License

private void createUI_10_Title(final Composite parent) {

    /*//from   w w w .j  av a 2 s .c  o m
     * Label: Slideout title
     */
    final Label label = new Label(parent, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(label);
    label.setText(Messages.Slideout_GraphMinMax_Label_Title);
    label.setFont(JFaceResources.getBannerFont());
}