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

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

Introduction

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

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:es.axios.udig.georeferencing.internal.ui.MainComposite.java

License:LGPL

/**
 * This method initializes compositeInformation
 * /* w  ww  . j  ava2s .  c  o  m*/
 */
private void createCompositeInformation(final Composite parent) {

    GridData gridData6 = new GridData();
    gridData6.horizontalAlignment = GridData.FILL;
    gridData6.grabExcessHorizontalSpace = true;
    gridData6.grabExcessVerticalSpace = true;
    gridData6.verticalAlignment = GridData.FILL;

    informationComposite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(3, false);
    informationComposite.setLayoutData(gridData6);
    informationComposite.setLayout(gridLayout);

    this.messageImage = new CLabel(informationComposite, SWT.NONE);
    GridData gridData7 = new GridData();
    gridData7.horizontalAlignment = GridData.BEGINNING;
    gridData7.minimumWidth = 30;
    gridData7.widthHint = 30;
    this.messageImage.setLayoutData(gridData7);

    this.messageText = new CLabel(informationComposite, SWT.NONE);
    GridData gridData8 = new GridData();
    gridData8.horizontalAlignment = GridData.FILL;
    gridData8.grabExcessHorizontalSpace = true;
    gridData8.grabExcessVerticalSpace = true;
    gridData8.verticalAlignment = GridData.FILL;
    this.messageText.setLayoutData(gridData8);
    this.messageText.setFont(JFaceResources.getDialogFont());

    InfoMessage message = this.cmd.getMessage();
    displayMessage(message);
}

From source file:es.axios.udig.spatialoperations.ui.view.SOComposite.java

License:Open Source License

/**
 * This method initializes compositeInformation
 * /* w w w .j  av  a 2  s  .  co m*/
 */
private void createCompositeInformation(final Composite parent) {

    GridData gridData6 = new GridData();
    gridData6.horizontalAlignment = GridData.FILL;
    gridData6.grabExcessHorizontalSpace = true;
    gridData6.grabExcessVerticalSpace = true;
    gridData6.verticalAlignment = GridData.FILL;

    compositeInformation = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(3, false);
    compositeInformation.setLayoutData(gridData6);
    compositeInformation.setLayout(gridLayout);

    this.messageImage = new CLabel(compositeInformation, SWT.NONE);
    GridData gridData7 = new GridData();
    gridData7.horizontalAlignment = GridData.BEGINNING;
    gridData7.minimumWidth = 30;
    gridData7.widthHint = 30;
    this.messageImage.setLayoutData(gridData7);

    this.messageOperation = new CLabel(compositeInformation, SWT.NONE);
    GridData gridData5 = new GridData();
    gridData5.widthHint = 70;
    this.messageOperation.setLayoutData(gridData5);

    this.messageText = new CLabel(compositeInformation, SWT.NONE);
    GridData gridData8 = new GridData();
    gridData8.horizontalAlignment = GridData.FILL;
    gridData8.grabExcessHorizontalSpace = true;
    gridData8.grabExcessVerticalSpace = true;
    gridData8.verticalAlignment = GridData.FILL;
    this.messageText.setLayoutData(gridData8);
    // this.messageText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    this.messageText.setFont(JFaceResources.getDialogFont());
}

From source file:es.axios.udig.ui.editingtools.precisiontools.commons.view.AbstractParametersComposite.java

License:LGPL

private void createCompositeLegend(Composite parent) {

    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;/*from  ww w  . java 2 s  . c o m*/

    GridData gridData2 = new GridData();
    gridData2.horizontalAlignment = GridData.FILL;
    gridData2.grabExcessHorizontalSpace = true;
    gridData2.horizontalSpan = 3;
    gridData2.grabExcessVerticalSpace = false;
    gridData2.verticalAlignment = GridData.BEGINNING;

    compositeLegend = new Composite(parent, SWT.NONE);
    compositeLegend.setLayout(gridLayout);
    compositeLegend.setLayoutData(gridData2);

    messageImage = new CLabel(compositeLegend, SWT.NONE);
    GridData gridData7 = new GridData();
    gridData7.horizontalAlignment = GridData.BEGINNING;
    gridData7.minimumWidth = 30;
    gridData7.widthHint = 30;
    messageImage.setLayoutData(gridData7);

    messageText = new CLabel(compositeLegend, SWT.NONE);
    GridData gridData8 = new GridData();
    gridData8.horizontalAlignment = GridData.FILL;
    gridData8.grabExcessHorizontalSpace = true;
    gridData8.grabExcessVerticalSpace = true;
    gridData8.verticalAlignment = GridData.FILL;
    messageText.setLayoutData(gridData8);
    messageText.setFont(JFaceResources.getDialogFont());

    InfoMessage infoMessage = new InfoMessage(Messages.PrecisionParallel_InitialMessage, Type.INFORMATION);
    messageImage.setImage(infoMessage.getImage());
    messageText.setText(infoMessage.getText());

}

From source file:eu.geclipse.jsdl.ui.internal.dialogs.InputDialog.java

License:Open Source License

protected Button createButton(final Composite parent, final String label, final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);/*  ww  w  .j a v  a 2 s  .  c  om*/
    button.setFont(JFaceResources.getDialogFont());
    // button.addSelectionListener( new SelectionAdapter() {
    //
    // @Override
    // public void widgetSelected( final SelectionEvent event ) {
    // buttonPressed( ( ( Integer )event.widget.getData() ).intValue() );
    // }
    // } );
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:eu.hydrologis.jgrass.uibuilder.jgrassdependent.GuiBuilderDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    /*// w  ww.j  a  va  2s.  c o  m
     * add the help button
     */
    ((GridLayout) parent.getLayout()).numColumns++;
    Button helpButton = new Button(parent, SWT.PUSH);
    Image helpImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    helpButton.setImage(helpImg);
    helpButton.setFont(JFaceResources.getDialogFont());
    helpButton.setData(new Integer(HELP_ID));
    helpButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
}

From source file:ext.org.eclipse.jdt.internal.ui.javadocexport.JavadocWizard.java

License:Open Source License

public static void openJavadocWizard(JavadocWizard wizard, Shell shell, IStructuredSelection selection) {
    wizard.init(PlatformUI.getWorkbench(), selection);

    WizardDialog dialog = new WizardDialog(shell, wizard) {
        @Override/*from  w  ww . java  2  s. com*/
        protected IDialogSettings getDialogBoundsSettings() {
            // added so that the wizard can remember the last used size
            return JavaPlugin.getDefault().getDialogSettingsSection("JavadocWizardDialog"); //$NON-NLS-1$
        }
    };
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(100),
            converter.convertHeightInCharsToPixels(20));
    dialog.open();
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.AppearancePreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*from www. j  ava  2s. com*/
    int nColumns = 1;

    Composite result = new Composite(parent, SWT.NONE);
    result.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.numColumns = nColumns;
    result.setLayout(layout);

    fShowMethodReturnType.doFillIntoGrid(result, nColumns);
    fShowMethodTypeParameters.doFillIntoGrid(result, nColumns);
    fShowCategory.doFillIntoGrid(result, nColumns);
    fShowMembersInPackageView.doFillIntoGrid(result, nColumns);
    fFoldPackagesInPackageExplorer.doFillIntoGrid(result, nColumns);

    new Separator().doFillIntoGrid(result, nColumns);

    fCompressPackageNames.doFillIntoGrid(result, nColumns);
    fPackageNamePattern.doFillIntoGrid(result, 2);
    LayoutUtil.setHorizontalIndent(fPackageNamePattern.getLabelControl(null),
            AbstractConfigurationBlock.INDENT);
    Text packageNamePatternControl = fPackageNamePattern.getTextControl(null);
    LayoutUtil.setHorizontalIndent(packageNamePatternControl, AbstractConfigurationBlock.INDENT);
    LayoutUtil.setHorizontalGrabbing(packageNamePatternControl);
    LayoutUtil.setWidthHint(fPackageNamePattern.getLabelControl(null), convertWidthInCharsToPixels(65));

    new Separator().doFillIntoGrid(result, nColumns);
    fAbbreviatePackageNames.doFillIntoGrid(result, nColumns);
    fAbbreviatePackageNamePattern.doFillIntoGrid(result, 2);
    LayoutUtil.setHorizontalIndent(fAbbreviatePackageNamePattern.getLabelControl(null),
            AbstractConfigurationBlock.INDENT);
    Text abbreviatePackageNamePatternControl = fAbbreviatePackageNamePattern.getTextControl(null);
    LayoutUtil.setHorizontalIndent(abbreviatePackageNamePatternControl, AbstractConfigurationBlock.INDENT);
    LayoutUtil.setHorizontalGrabbing(abbreviatePackageNamePatternControl);
    LayoutUtil.setWidthHint(fAbbreviatePackageNamePattern.getLabelControl(null),
            convertWidthInCharsToPixels(65));
    LayoutUtil.setVerticalGrabbing(abbreviatePackageNamePatternControl);
    LayoutUtil.setHeightHint(abbreviatePackageNamePatternControl, convertHeightInCharsToPixels(3));

    new Separator().doFillIntoGrid(result, nColumns);
    fStackBrowsingViewsVertically.doFillIntoGrid(result, nColumns);

    String noteTitle = PreferencesMessages.AppearancePreferencePage_note;
    String noteMessage = PreferencesMessages.AppearancePreferencePage_preferenceOnlyEffectiveForNewPerspectives;
    Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), result, noteTitle, noteMessage);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.horizontalIndent = AbstractConfigurationBlock.INDENT;
    noteControl.setLayoutData(gd);

    initFields();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.CodeAssistAdvancedConfigurationBlock.java

License:Open Source License

private int computeWidth(Control control, String name) {
    if (name == null)
        return 0;
    GC gc = new GC(control);
    try {//from   w w  w.  j  a  v a2s.co  m
        gc.setFont(JFaceResources.getDialogFont());
        return gc.stringExtent(name).x + 10;
    } finally {
        gc.dispose();
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Button addCheckBoxWithLink(Composite parent, final String label, Key key, String[] values, int indent,
        int widthHint, final SelectionListener listener) {
    LinkControlData data = new LinkControlData(key, values);

    GridData gd = new GridData(GridData.FILL, GridData.FILL, true, false);
    gd.horizontalSpan = 3;/*  ww w .ja  va  2s . com*/
    gd.horizontalIndent = indent;

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(gd);

    final Button checkBox = new Button(composite, SWT.CHECK);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setData(data);
    checkBox.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
    checkBox.addSelectionListener(getSelectionListener());
    checkBox.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        @Override
        public void getName(AccessibleEvent e) {
            e.result = LegacyActionTools.removeMnemonics(label.replaceAll("</?[aA][^>]*>", "")); //$NON-NLS-1$ //$NON-NLS-2$
        }
    });

    gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = widthHint;
    gd.horizontalIndent = -2;

    Link link = new Link(composite, SWT.NONE);
    link.setText(label);
    link.setLayoutData(gd);
    data.setLink(link);

    // toggle checkbox when user clicks unlinked text in link:
    final boolean[] linkSelected = { false };
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            linkSelected[0] = true;
            if (listener != null) {
                listener.widgetSelected(e);
            }
        }
    });
    link.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            linkSelected[0] = false;
        }

        @Override
        public void mouseUp(MouseEvent e) {
            if (!linkSelected[0]) {
                checkBox.setSelection(!checkBox.getSelection());
                checkBox.setFocus();
                linkSelected[0] = false;
                controlChanged(checkBox);
            }
        }
    });
    link.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit == true) {
                e.detail = SWT.TRAVERSE_NONE;
                checkBox.setSelection(!checkBox.getSelection());
                checkBox.setFocus();
                linkSelected[0] = false;
                controlChanged(checkBox);
            }
        }
    });

    makeScrollableCompositeAware(link);
    makeScrollableCompositeAware(checkBox);

    updateCheckBox(checkBox);

    fCheckBoxes.add(checkBox);

    return checkBox;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) {
    Label labelControl = new Label(parent, SWT.WRAP);
    labelControl.setText(label);/*from  www.jav  a 2s  .c o m*/
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setLayoutData(new GridData());

    Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
    textBox.setData(key);
    textBox.setLayoutData(new GridData());

    makeScrollableCompositeAware(textBox);

    fLabels.put(textBox, labelControl);

    updateText(textBox);

    textBox.addModifyListener(getTextModifyListener());

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    if (widthHint != 0) {
        data.widthHint = widthHint;
    }
    data.horizontalIndent = indent;
    data.horizontalSpan = 2;
    textBox.setLayoutData(data);

    fTextBoxes.add(textBox);
    return textBox;
}