Example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN

List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.

Prototype

int VERTICAL_MARGIN

To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.

Click Source Link

Document

Vertical margin in dialog units (value 7).

Usage

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.CompilationDirectorySourceContainerDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Image image = fNewContainer ? CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ)
            : CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ);
    setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2);
    setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3);
    setTitleImage(image);//from  w  w w. j av  a 2s .c o m
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Font font = parentComposite.getFont();
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(font);

    Composite dirComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(2, false);
    dirComposite.setLayout(layout);
    dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    dirComposite.setFont(font);

    Label label = new Label(dirComposite, SWT.NONE);
    label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(font);

    fDirText = new Text(dirComposite, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    fDirText.setLayoutData(data);
    fDirText.setFont(font);
    fDirText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });

    Button button = new Button(dirComposite, SWT.PUSH);
    button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    button.setLayoutData(data);
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            browse();
        }
    });

    fSubfoldersButton = new Button(dirComposite, SWT.CHECK);
    fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing
    fSubfoldersButton.setLayoutData(data);
    fSubfoldersButton.setFont(font);

    return parentComposite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.PathMappingDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    setTitle(SourceLookupUIMessages.PathMappingDialog_11);
    setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));

    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from   w ww .  j  a  v  a2 s . co m*/
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(font);

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
            ICDebugHelpContextIds.SOURCE_PATH_MAPPING_DIALOG);

    Composite nameComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    nameComp.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    nameComp.setLayoutData(data);
    nameComp.setFont(font);

    Label label = new Label(nameComp, SWT.LEFT);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    label.setLayoutData(data);
    label.setFont(font);
    label.setText(SourceLookupUIMessages.PathMappingDialog_12);
    fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    fNameText.setLayoutData(data);
    fNameText.setFont(font);
    fNameText.setText(getMapping().getName());
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
        }
    });

    fViewer = createViewer(composite);
    data = new GridData(GridData.FILL_BOTH);
    fViewer.getControl().setLayoutData(data);
    fViewer.getControl().setFont(font);
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.marginHeight = 0;
    buttonLayout.marginWidth = 0;
    buttonComp.setLayout(buttonLayout);
    data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);
    buttonComp.setFont(font);

    GC gc = new GC(parent);
    gc.setFont(parent.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_13, fontMetrics);
    fAddButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntryDialog dialog = new MapEntryDialog(getShell());
            if (dialog.open() == Window.OK) {
                getViewer().refresh();
            }
        }
    });

    fEditButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_14, fontMetrics);
    fEditButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            if (entries.length > 0) {
                MapEntryDialog dialog = new MapEntryDialog(getShell(), entries[0]);
                if (dialog.open() == Window.OK) {
                    getViewer().refresh();
                }
            }
        }
    });

    fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15, fontMetrics);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            for (int i = 0; i < entries.length; ++i) {
                fMapping.removeMapEntry(entries[i]);
            }
            getViewer().refresh();
        }
    });

    setMessage(null);
    fViewer.setInput(fMapping);

    return composite;
}

From source file:org.eclipse.cdt.internal.ui.build.BuildPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/* www.  ja v a  2s.c om*/

    Composite container = 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);
    container.setLayout(layout);

    // Build either default configuration or all.
    Group gr = addGroup(container, PreferencesMessages.CPluginPreferencePage_build_scope);
    Label l1 = new Label(gr, SWT.NONE);
    l1.setText(PreferencesMessages.CPluginPreferencePage_1);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalIndent = GROUP_VINDENT;
    l1.setLayoutData(gd);

    boolean needAllConfigBuild = ACBuilder.needAllConfigBuild();

    buildActive = new Button(gr, SWT.RADIO);
    buildActive.setText(PreferencesMessages.CPluginPreferencePage_2);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalIndent = GROUP_VINDENT;
    gd.horizontalIndent = GROUP_HINDENT;
    buildActive.setLayoutData(gd);
    buildActive.setSelection(!needAllConfigBuild);

    buildAll = new Button(gr, SWT.RADIO);
    buildAll.setText(PreferencesMessages.CPluginPreferencePage_3);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = GROUP_HINDENT;
    buildAll.setLayoutData(gd);
    buildAll.setSelection(needAllConfigBuild);

    addNote(gr, PreferencesMessages.CPluginPreferencePage_4);

    // Building project dependencies.
    Group gr2 = addGroup(container, PreferencesMessages.CPluginPreferencePage_building_configurations);
    buildOnlyOnRefChange = new Button(gr2, SWT.CHECK);
    buildOnlyOnRefChange.setText(PreferencesMessages.CPluginPreferencePage_7);
    GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
    gd2.verticalIndent = GROUP_VINDENT;
    buildOnlyOnRefChange.setLayoutData(gd2);
    buildOnlyOnRefChange.setSelection(ACBuilder.buildConfigResourceChanges());

    Dialog.applyDialogFont(container);
    return container;
}

From source file:org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog.java

License:Open Source License

@Override
protected Control createCustomArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/* w w  w  .  j av  a  2 s . c  o  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT);
    fHideDialogCheckBox.setText(fHideMessage);
    fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setDialogEnabled(fId, !((Button) e.widget).getSelection());
        }
    });
    applyDialogFont(fHideDialogCheckBox);
    return fHideDialogCheckBox;
}

From source file:org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

/**
 * Overrides method in Dialog/* w ww.  j ava2 s . c  o m*/
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    Composite group = composite;

    // Checkbox
    fEnableUserDefinedPatterns = new Button(group, SWT.CHECK);
    fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern);

    // Pattern   field
    fUserDefinedPatterns = new Text(group, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = convertWidthInCharsToPixels(59);
    fUserDefinedPatterns.setLayoutData(data);
    String patterns = convertToString(fPatterns, SEPARATOR);
    fUserDefinedPatterns.setText(patterns);

    // Info text
    final Label info = new Label(group, SWT.LEFT);
    info.setText(FilterMessages.CustomFiltersDialog_patternInfo);

    // Enabling / disabling of pattern group
    fEnableUserDefinedPatterns.setSelection(fEnablePatterns);
    fUserDefinedPatterns.setEnabled(fEnablePatterns);
    info.setEnabled(fEnablePatterns);
    fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean state = fEnableUserDefinedPatterns.getSelection();
            fUserDefinedPatterns.setEnabled(state);
            info.setEnabled(fEnableUserDefinedPatterns.getSelection());
            if (state)
                fUserDefinedPatterns.setFocus();
        }
    });

    // Filters provided by extension point
    if (fBuiltInFilters.length > 0)
        createCheckBoxList(group);

    applyDialogFont(parent);
    return parent;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from ww w . j a va  2 s.c  o  m
    int nColumns = 1;

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.numColumns = nColumns;
    result.setLayout(layout);

    fShowTUChildren.doFillIntoGrid(result, nColumns);
    fCViewGroupIncludes.doFillIntoGrid(result, nColumns);
    fOutlineGroupIncludes.doFillIntoGrid(result, nColumns);
    fOutlineGroupNamespaces.doFillIntoGrid(result, nColumns);
    fOutlineGroupMembers.doFillIntoGrid(result, nColumns);
    fCViewGroupMacros.doFillIntoGrid(result, nColumns);
    fOutlineGroupMacros.doFillIntoGrid(result, nColumns);

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

    fCViewSeparateHeaderAndSource.doFillIntoGrid(result, nColumns);
    fCViewSortOrderOfExcludedFiles.doFillIntoGrid(result, nColumns);

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

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

    initFields();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:org.eclipse.cdt.internal.ui.preferences.CParserPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    fOverlayStore.load();/*from w ww. j ava 2 s  .  com*/
    fOverlayStore.start();

    initializeDialogUnits(parent);

    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);

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

    bufferTextControl = (Text) addTextField(bufferGroup,
            PreferencesMessages.CBufferPreferences_CodeReaderBuffer_Size, 6, 0);

    initialize();

    return result;

}

From source file:org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);// ww  w  .j a  v a2s .co m

    Composite container = 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);
    container.setLayout(layout);

    Group outlineViewGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_outline_view);
    addCheckBox(outlineViewGroup, PreferencesMessages.CPluginPreferencePage_structuralParseMode_label,
            PreferenceConstants.PREF_USE_STRUCTURAL_PARSE_MODE);

    addNote(outlineViewGroup, PreferencesMessages.CPluginPreferencePage_performanceHint);

    // Refactoring.
    Group refactoringGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_refactoring_title);
    addCheckBox(refactoringGroup, PreferencesMessages.CPluginPreferencePage_refactoring_auto_save,
            PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS);
    addCheckBox(refactoringGroup, PreferencesMessages.CPluginPreferencePage_refactoring_lightweight,
            PreferenceConstants.REFACTOR_LIGHTWEIGHT);

    Group dontAskGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_cdtDialogs_group, 2);
    Label label = new Label(dontAskGroup, SWT.WRAP);
    label.setText(PreferencesMessages.CPluginPreferencePage_clearDoNotShowAgainSettings_label);
    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.CPluginPreferencePage_clear_button);
    clearButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
    clearButton.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            OptionalMessageDialog.clearAllRememberedStates();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            OptionalMessageDialog.clearAllRememberedStates();
        }
    });
    SWTUtil.setButtonDimensionHint(clearButton);
    Dialog.applyDialogFont(container);
    return container;
}

From source file:org.eclipse.cdt.internal.ui.preferences.formatter.CreateProfileDialog.java

License:Open Source License

@Override
public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;//  w  w  w . ja v  a 2 s .c  o  m

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(layout);

    // Create "Profile name:" label
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    final Label nameLabel = new Label(composite, SWT.WRAP);
    nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text);
    nameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });

    // Create "Initialize settings ..." label
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    Label profileLabel = new Label(composite, SWT.WRAP);
    profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text);
    profileLabel.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fProfileCombo.setLayoutData(gd);

    // "Open the edit dialog now" checkbox
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    fEditCheckbox = new Button(composite, SWT.CHECK);
    fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

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

    final IDialogSettings dialogSettings = CUIPlugin.getDefault().getDialogSettings();//.get(PREF_OPEN_EDIT_DIALOG);
    if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
        fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
    } else {
        fOpenEditDialog = true;
    }
    fEditCheckbox.setSelection(fOpenEditDialog);

    fProfileCombo.setItems(fSortedNames);
    fProfileCombo.setText(fProfileManager.getDefaultProfile().getName());
    updateStatus(fEmpty);

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage.java

License:Open Source License

/**
 * Create the contents of this tab page. Subclasses cannot override this, 
 * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also
 * be overridden as necessary./*from  w w w .j a v a 2  s .c  o  m*/
 * @param parent The parent composite
 * @return Created content control
 */
@Override
public final Composite createContents(Composite parent) {
    final int numColumns = 4;

    if (fPixelConverter == null) {
        fPixelConverter = new PixelConverter(parent);
    }

    final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
    sashForm.setFont(parent.getFont());

    Composite scrollContainer = new Composite(sashForm, SWT.NONE);

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    scrollContainer.setLayoutData(gridData);

    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    scrollContainer.setLayout(layout);

    ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL);
    scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scroll.setExpandHorizontal(true);
    scroll.setExpandVertical(true);

    final Composite settingsContainer = new Composite(scroll, SWT.NONE);
    settingsContainer.setFont(sashForm.getFont());

    scroll.setContent(settingsContainer);

    settingsContainer.setLayout(new PageLayout(scroll, 400, 400));
    settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite settingsPane = new Composite(settingsContainer, SWT.NONE);
    settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = (int) (1.5
            * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    settingsPane.setLayout(layout);
    doCreatePreferences(settingsPane, numColumns);

    settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scroll.addControlListener(new ControlListener() {

        @Override
        public void controlMoved(ControlEvent e) {
        }

        @Override
        public void controlResized(ControlEvent e) {
            settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });

    Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL);
    gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
    sashHandle.setLayoutData(gridData);

    final Composite previewPane = new Composite(sashForm, SWT.NONE);
    previewPane.setLayout(createGridLayout(numColumns, true));
    previewPane.setFont(sashForm.getFont());
    doCreatePreviewPane(previewPane, numColumns);

    initializePage();

    sashForm.setWeights(new int[] { 3, 3 });
    return sashForm;
}