Example usage for org.eclipse.jface.dialogs Dialog applyDialogFont

List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog applyDialogFont.

Prototype

public static void applyDialogFont(Control control) 

Source Link

Document

Applies the dialog font to all controls that currently have the default font.

Usage

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    setShell(parent.getShell());//from  w  ww .  j a  va 2s .  com

    fPixelConverter = new PixelConverter(parent);

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

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;

    composite.setLayout(layout);

    fOrderListField.doFillIntoGrid(composite, 3);
    LayoutUtil.setHorizontalSpan(fOrderListField.getLabelControl(null), 2);
    LayoutUtil.setWidthHint(fOrderListField.getLabelControl(null),
            fPixelConverter.convertWidthInCharsToPixels(60));
    LayoutUtil.setHorizontalGrabbing(fOrderListField.getListControl(null));

    Composite importExportComp = new Composite(composite, SWT.NONE);
    importExportComp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;

    importExportComp.setLayout(layout);

    fImportButton.doFillIntoGrid(importExportComp, 1);
    fExportButton.doFillIntoGrid(importExportComp, 1);

    fThresholdField.doFillIntoGrid(composite, 2);
    ((GridData) fThresholdField.getTextControl(null).getLayoutData()).grabExcessHorizontalSpace = false;
    fStaticThresholdField.doFillIntoGrid(composite, 2);
    fIgnoreLowerCaseTypesField.doFillIntoGrid(composite, 2);

    Dialog.applyDialogFont(composite);

    return composite;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from   w  w w. j  ava 2  s .  c om

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    result.setLayout(layout);

    // new Label(composite, SWT.NONE); // spacer
    // Group linkSettings= new Group(result, SWT.NONE);
    // linkSettings.setLayout(new GridLayout());
    // linkSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // linkSettings.setText(PreferencesMessages.getString("JavaBasePreferencePage.linkSettings.text")); //$NON-NLS-1$
    //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkJavaBrowsingViewsCheckbox.text"), LINK_BROWSING_VIEW_TO_EDITOR); //$NON-NLS-1$
    //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkPackageView"), LINK_PACKAGES_TO_EDITOR); //$NON-NLS-1$
    //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkTypeHierarchy"), LINK_TYPEHIERARCHY_TO_EDITOR); //$NON-NLS-1$

    // new Label(result, SWT.NONE); // spacer

    Group doubleClickGroup = new Group(result, SWT.NONE);
    doubleClickGroup.setLayout(new GridLayout());
    doubleClickGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    doubleClickGroup.setText(PreferencesMessages.JavaBasePreferencePage_doubleclick_action);
    addRadioButton(doubleClickGroup, PreferencesMessages.JavaBasePreferencePage_doubleclick_gointo,
            DOUBLE_CLICK, DOUBLE_CLICK_GOES_INTO);
    addRadioButton(doubleClickGroup, PreferencesMessages.JavaBasePreferencePage_doubleclick_expand,
            DOUBLE_CLICK, DOUBLE_CLICK_EXPANDS);

    // new Label(result, SWT.NONE); // spacer

    Group typeHierarchyGroup = new Group(result, SWT.NONE);
    typeHierarchyGroup.setLayout(new GridLayout());
    typeHierarchyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    typeHierarchyGroup.setText(PreferencesMessages.JavaBasePreferencePage_openTypeHierarchy);
    addRadioButton(typeHierarchyGroup, PreferencesMessages.JavaBasePreferencePage_inPerspective,
            OPEN_TYPE_HIERARCHY, OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE);
    addRadioButton(typeHierarchyGroup, PreferencesMessages.JavaBasePreferencePage_inView, OPEN_TYPE_HIERARCHY,
            OPEN_TYPE_HIERARCHY_IN_VIEW_PART);

    Group refactoringGroup = new Group(result, SWT.NONE);
    refactoringGroup.setLayout(new GridLayout());
    refactoringGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    refactoringGroup.setText(PreferencesMessages.JavaBasePreferencePage_refactoring_title);
    addCheckBox(refactoringGroup, PreferencesMessages.JavaBasePreferencePage_refactoring_auto_save,
            RefactoringSavePreferences.PREF_SAVE_ALL_EDITORS);
    addCheckBox(refactoringGroup, PreferencesMessages.JavaBasePreferencePage_refactoring_lightweight,
            PreferenceConstants.REFACTOR_LIGHTWEIGHT);

    Group group = new Group(result, SWT.NONE);
    group.setLayout(new GridLayout());
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setText(PreferencesMessages.JavaBasePreferencePage_search);

    addCheckBox(group, PreferencesMessages.JavaBasePreferencePage_search_small_menu,
            PreferenceConstants.SEARCH_USE_REDUCED_MENU);

    layout = new GridLayout();
    layout.numColumns = 2;

    Group dontAskGroup = new Group(result, SWT.NONE);
    dontAskGroup.setLayout(layout);
    dontAskGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    dontAskGroup.setText(PreferencesMessages.JavaBasePreferencePage_dialogs);

    Label label = new Label(dontAskGroup, SWT.WRAP);
    label.setText(PreferencesMessages.JavaBasePreferencePage_do_not_hide_description);
    GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
    data.widthHint = convertVerticalDLUsToPixels(50);
    label.setLayoutData(data);

    Button clearButton = new Button(dontAskGroup, SWT.PUSH);
    clearButton.setText(PreferencesMessages.JavaBasePreferencePage_do_not_hide_button);
    clearButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
    clearButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            unhideAllDialogs();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            unhideAllDialogs();
        }
    });

    SWTUtil.setButtonDimensionHint(clearButton);
    Dialog.applyDialogFont(result);
    return result;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    if (!fIsValidElement || fIsReadOnly) {
        Composite inner = new Composite(parent, SWT.NONE);

        if (fIsReadOnly) {
            GridLayout layout = new GridLayout();
            layout.marginWidth = 0;//from   w  w  w.j  av a  2 s.  c o m
            inner.setLayout(layout);

            Label label = new Label(inner, SWT.WRAP);
            label.setText(PreferencesMessages.JavadocConfigurationPropertyPage_location_path);

            Text location = new Text(inner, SWT.READ_ONLY | SWT.WRAP);
            GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
            gd.widthHint = convertWidthInCharsToPixels(80);
            location.setLayoutData(gd);
            String locationPath = PreferencesMessages.JavadocConfigurationPropertyPage_locationPath_none;
            if (fEntry != null) {
                URL javadocUrl = JavaDocLocations.getLibraryJavadocLocation(fEntry);
                if (javadocUrl != null) {
                    locationPath = javadocUrl.toExternalForm();
                }
            }
            location.setText(locationPath);
            Dialog.applyDialogFont(inner);
        }
        return inner;
    }

    IJavaElement elem = getJavaElement();
    fInitalLocation = null;
    if (elem != null) {
        try {
            fInitalLocation = JavaUI.getJavadocBaseLocation(elem);
        } catch (JavaModelException e) {
            JavaPlugin.log(e);
        }
    }

    boolean isProject = (elem instanceof IJavaProject);
    fJavadocConfigurationBlock = new JavadocConfigurationBlock(getShell(), this, fInitalLocation, isProject);
    Control control = fJavadocConfigurationBlock.createContents(parent);
    control.setVisible(elem != null);

    Dialog.applyDialogFont(control);
    return control;
}

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

License:Open Source License

/**
 * Creates page for hover preferences.//  w w w  .  ja v  a 2s .co  m
 *
 * @param parent the parent composite
 * @return the control for the preference page
 */
public Control createControl(Composite parent) {

    ScrolledPageContent scrolled = new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);

    Composite hoverComposite = new Composite(scrolled, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    hoverComposite.setLayout(layout);

    String rollOverLabel = PreferencesMessages.JavaEditorHoverConfigurationBlock_annotationRollover;
    addCheckBox(hoverComposite, rollOverLabel, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER, 0);

    addFiller(hoverComposite);

    Label label = new Label(hoverComposite, SWT.NONE);
    label.setText(PreferencesMessages.JavaEditorHoverConfigurationBlock_hoverPreferences);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.BEGINNING;
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);

    TableLayoutComposite layouter = new TableLayoutComposite(hoverComposite, SWT.NONE);
    addColumnLayoutData(layouter);

    // Hover table
    fHoverTable = new Table(layouter,
            SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
    fHoverTable.setHeaderVisible(true);
    fHoverTable.setLinesVisible(true);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = SWTUtil.getTableHeightHint(fHoverTable, 10);
    gd.horizontalSpan = 2;
    gd.widthHint = new PixelConverter(parent).convertWidthInCharsToPixels(30);
    layouter.setLayoutData(gd);

    fHoverTable.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            handleHoverListSelection();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    TableLayout tableLayout = new TableLayout();
    fHoverTable.setLayout(tableLayout);

    fNameColumn = new TableColumn(fHoverTable, SWT.NONE);
    fNameColumn.setText(PreferencesMessages.JavaEditorHoverConfigurationBlock_nameColumnTitle);
    fNameColumn.setResizable(true);

    fModifierColumn = new TableColumn(fHoverTable, SWT.NONE);
    fModifierColumn.setText(PreferencesMessages.JavaEditorHoverConfigurationBlock_modifierColumnTitle);
    fModifierColumn.setResizable(true);

    fHoverTableViewer = new CheckboxTableViewer(fHoverTable);
    fHoverTableViewer.setUseHashlookup(true);
    fHoverTableViewer.setContentProvider(new JavaEditorTextHoverDescriptorContentProvider());
    fHoverTableViewer.setLabelProvider(new JavaEditorTextHoverDescriptorLabelProvider());

    ((CheckboxTableViewer) fHoverTableViewer).addCheckStateListener(new ICheckStateListener() {
        /*
         * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            String id = ((JavaEditorTextHoverDescriptor) event.getElement()).getId();
            if (id == null)
                return;
            JavaEditorTextHoverDescriptor[] descriptors = getContributedHovers();
            HoverConfig hoverConfig = null;
            int i = 0, length = fHoverConfigs.length;
            while (i < length) {
                if (id.equals(descriptors[i].getId())) {
                    hoverConfig = fHoverConfigs[i];
                    hoverConfig.fIsEnabled = event.getChecked();
                    fModifierEditor.setEnabled(event.getChecked());
                    fHoverTableViewer.setSelection(new StructuredSelection(descriptors[i]));
                }
                i++;
            }
            handleHoverListSelection();
            updateStatus(hoverConfig);
        }
    });

    // Text field for modifier string
    label = new Label(hoverComposite, SWT.LEFT);
    label.setText(PreferencesMessages.JavaEditorHoverConfigurationBlock_keyModifier);
    fModifierEditor = new Text(hoverComposite, SWT.BORDER);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    fModifierEditor.setLayoutData(gd);

    fModifierEditor.addKeyListener(new KeyListener() {
        private boolean isModifierCandidate;

        public void keyPressed(KeyEvent e) {
            isModifierCandidate = e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
        }

        public void keyReleased(KeyEvent e) {
            if (isModifierCandidate && e.stateMask > 0 && e.stateMask == e.stateMask && e.character == 0) {// && e.time -time < 1000) {
                String text = fModifierEditor.getText();
                Point selection = fModifierEditor.getSelection();
                int i = selection.x - 1;
                while (i > -1 && Character.isWhitespace(text.charAt(i))) {
                    i--;
                }
                boolean needsPrefixDelimiter = i > -1 && !String.valueOf(text.charAt(i)).equals(DELIMITER);

                i = selection.y;
                while (i < text.length() && Character.isWhitespace(text.charAt(i))) {
                    i++;
                }
                boolean needsPostfixDelimiter = i < text.length()
                        && !String.valueOf(text.charAt(i)).equals(DELIMITER);

                String insertString;

                if (needsPrefixDelimiter && needsPostfixDelimiter)
                    insertString = Messages.format(
                            PreferencesMessages.JavaEditorHoverConfigurationBlock_insertDelimiterAndModifierAndDelimiter,
                            new String[] { Action.findModifierString(e.stateMask) });
                else if (needsPrefixDelimiter)
                    insertString = Messages.format(
                            PreferencesMessages.JavaEditorHoverConfigurationBlock_insertDelimiterAndModifier,
                            new String[] { Action.findModifierString(e.stateMask) });
                else if (needsPostfixDelimiter)
                    insertString = Messages.format(
                            PreferencesMessages.JavaEditorHoverConfigurationBlock_insertModifierAndDelimiter,
                            new String[] { Action.findModifierString(e.stateMask) });
                else
                    insertString = Action.findModifierString(e.stateMask);

                if (insertString != null)
                    fModifierEditor.insert(insertString);
            }
        }
    });

    fModifierEditor.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            handleModifierModified();
        }
    });

    // Description
    Label descriptionLabel = new Label(hoverComposite, SWT.LEFT);
    descriptionLabel.setText(PreferencesMessages.JavaEditorHoverConfigurationBlock_description);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.horizontalSpan = 2;
    descriptionLabel.setLayoutData(gd);
    fDescription = new Text(hoverComposite, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
    gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 2;
    fDescription.setLayoutData(gd);

    initialize();

    scrolled.setContent(hoverComposite);
    final Point size = hoverComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrolled.setMinSize(size.x, size.y);

    Dialog.applyDialogFont(scrolled);

    return scrolled;

}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setLayout(new GridLayout());

    Link link = new Link(composite, SWT.WRAP);
    GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    data.widthHint = 300;//from w  ww. j ava  2s. c  o m
    link.setLayoutData(data);
    link.setText(PreferencesMessages.JavaEditorPropertyPage_SaveActionLink_Text);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
            container.openPage(SaveParticipantPreferencePage.PROPERTY_PAGE_ID, null);
        }
    });
    noDefaultAndApplyButton();
    Dialog.applyDialogFont(composite);
    return composite;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    // Create both the dialog lists
    Composite sortComposite = new Composite(parent, SWT.NONE);
    sortComposite.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//w w w  .jav a  2 s .c  o m
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    sortComposite.setLayout(layout);

    GridData gd = new GridData();
    gd.verticalAlignment = GridData.FILL;
    gd.horizontalAlignment = GridData.FILL_HORIZONTAL;
    sortComposite.setLayoutData(gd);

    createListDialogField(sortComposite, fSortOrderList);

    fUseVisibilitySortField = new SelectionButtonDialogField(SWT.CHECK);
    fUseVisibilitySortField.setDialogFieldListener(new IDialogFieldListener() {
        public void dialogFieldChanged(DialogField field) {
            fVisibilityOrderList.setEnabled(fUseVisibilitySortField.isSelected());
        }
    });
    fUseVisibilitySortField
            .setLabelText(PreferencesMessages.MembersOrderPreferencePage_usevisibilitysort_label);
    fUseVisibilitySortField.doFillIntoGrid(sortComposite, 2);
    fUseVisibilitySortField.setSelection(fUseVisibilitySort);

    createListDialogField(sortComposite, fVisibilityOrderList);
    fVisibilityOrderList.setEnabled(fUseVisibilitySortField.isSelected());

    Dialog.applyDialogFont(sortComposite);

    return sortComposite;
}

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

License:Open Source License

/**
 * {@inheritDoc}//from   w  ww. jav  a 2s.c om
 */
@Override
protected Control createContents(Composite parent) {
    if (!fIsValidElement || fIsReadOnly) {
        Composite inner = new Composite(parent, SWT.NONE);

        if (fIsReadOnly) {
            GridLayout layout = new GridLayout();
            layout.marginWidth = 0;
            inner.setLayout(layout);

            Label label = new Label(inner, SWT.WRAP);
            label.setText(PreferencesMessages.NativeLibrariesPropertyPage_location_path);

            Text location = new Text(inner, SWT.READ_ONLY | SWT.WRAP);
            GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
            gd.widthHint = convertWidthInCharsToPixels(80);
            location.setLayoutData(gd);
            String locationPath = PreferencesMessages.NativeLibrariesPropertyPage_locationPath_none;
            if (fEntry != null) {
                String nativeLibrariesPath = getNativeLibrariesPath(fEntry);
                if (nativeLibrariesPath != null)
                    locationPath = nativeLibrariesPath;
            }
            location.setText(locationPath);
            Dialog.applyDialogFont(inner);
        }
        return inner;
    }

    IJavaElement elem = getJavaElement();
    if (elem == null)
        return new Composite(parent, SWT.NONE);

    fInitialNativeLibPath = getNativeLibrariesPath(fEntry);
    fConfigurationBlock = new NativeLibrariesConfigurationBlock(this, getShell(), fInitialNativeLibPath,
            fEntry);
    Control control = fConfigurationBlock.createContents(parent);

    Dialog.applyDialogFont(control);
    return control;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from  ww w  .  ja v a 2 s  .co m

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    result.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    Group sourceFolderGroup = new Group(result, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    sourceFolderGroup.setLayout(layout);
    sourceFolderGroup.setLayoutData(gd);
    sourceFolderGroup.setText(PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_label);

    int indent = 0;

    fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, indent);
    fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

    fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, indent);
    fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

    indent = convertWidthInCharsToPixels(4);

    fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fSrcFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_src);
    fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent);
    fSrcFolderNameText.addModifyListener(fModifyListener);

    fBinFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fBinFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_bin);
    fBinFolderNameText = addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent);
    fBinFolderNameText.addModifyListener(fModifyListener);

    String[] jreNames = getJRENames();
    if (jreNames.length > 0) {
        Label jreSelectionLabel = new Label(result, SWT.NONE);
        jreSelectionLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_jrelibrary_label);
        jreSelectionLabel.setLayoutData(new GridData());

        int index = getPreferenceStore().getInt(CLASSPATH_JRELIBRARY_INDEX);
        fJRECombo = new Combo(result, SWT.READ_ONLY);
        fJRECombo.setItems(jreNames);
        fJRECombo.select(index);
        fJRECombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // page group
    Composite composite = (Composite) super.createDialogArea(parent);

    Font font = parent.getFont();
    composite.setFont(font);//from  w w w. j  a  v a2 s  .c  om

    createMessageArea(composite);

    fTableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            doSelectionChanged(((IStructuredSelection) event.getSelection()).toArray());
        }
    });
    fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    fTableViewer.getTable().setLayoutData(data);

    fTableViewer.setLabelProvider(new JavaElementLabelProvider());
    fTableViewer.setContentProvider(new StandardJavaElementContentProvider());
    fTableViewer.setComparator(new JavaElementComparator());
    fTableViewer.getControl().setFont(font);

    Button checkbox = new Button(composite, SWT.CHECK);
    checkbox.setText(PreferencesMessages.ProjectSelectionDialog_filter);
    checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
    checkbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            updateFilter(((Button) e.widget).getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateFilter(((Button) e.widget).getSelection());
        }
    });
    IDialogSettings dialogSettings = JavaPlugin.getDefault().getDialogSettings();
    boolean doFilter = !dialogSettings.getBoolean(DIALOG_SETTINGS_SHOW_ALL)
            && !fProjectsWithSpecifics.isEmpty();
    checkbox.setSelection(doFilter);
    updateFilter(doFilter);

    IJavaModel input = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    fTableViewer.setInput(input);

    doSelectionChanged(new Object[0]);
    Dialog.applyDialogFont(composite);
    return composite;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    fOverlayStore.load();/*w w  w .jav a  2 s.c om*/
    fOverlayStore.start();

    Composite contents = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(GridData.FILL_BOTH));

    createHeader(contents);

    createSyntaxPage(contents);

    initialize();

    Dialog.applyDialogFont(contents);
    return contents;
}