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.debug.internal.ui.sourcelookup.browsers.DirectorySourceContainerDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Image image = (fNewContainer) ? DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_ADD_SRC_DIR_WIZ)
            : DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_EDIT_SRC_DIR_WIZ);
    setTitle(SourceLookupUIMessages.DirectorySourceContainerDialog_2);
    setMessage(SourceLookupUIMessages.DirectorySourceContainerDialog_3);
    setTitleImage(image);/*from   www.ja  v a  2s . c  om*/
    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.DirectorySourceContainerDialog_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() {
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });

    Button button = new Button(dirComposite, SWT.PUSH);
    button.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_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() {
        public void widgetSelected(SelectionEvent event) {
            browse();
        }
    });

    fSubfoldersButton = new Button(composite, SWT.CHECK);
    fSubfoldersButton.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_6);

    return parentComposite;
}

From source file:org.eclipse.debug.ui.sourcelookup.SourceLookupDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    setTitle(SourceLookupUIMessages.manageSourceDialog_description);
    setTitleImage(DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_EDIT_SRC_LOC_WIZ));
    setMessage(SourceLookupUIMessages.SourceLookupDialog_add_edit_remove);
    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);//from  w w w.ja v  a 2s . com
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    fPanel = new SourceLookupPanel();
    fPanel.createControl(composite);
    fPanel.initializeFrom(fDirector);
    Dialog.applyDialogFont(composite);
    ILaunchConfiguration config = fDirector.getLaunchConfiguration();
    if (config != null && config.isReadOnly()) {
        setErrorMessage(SourceLookupUIMessages.SourceLookupDialog_0 + config.getName()
                + SourceLookupUIMessages.SourceLookupDialog_1);
    }
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IDebugHelpContextIds.EDIT_SOURCELOOKUP_DIALOG);

    return composite;
}

From source file:org.eclipse.dltk.internal.ui.callhierarchy.FiltersDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite superComposite = (Composite) super.createDialogArea(parent);

    Composite composite = new Composite(superComposite, SWT.NONE);
    composite.setFont(superComposite.getFont());
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    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);/*ww w  . j  a  va2  s. c  o  m*/

    createNamesArea(composite);
    new Label(composite, SWT.NONE); // Filler
    createMaxCallDepthArea(composite);

    updateUIFromFilter();

    return composite;
}

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

License:Open Source License

/**
 * Overrides method in Dialog/*from  w  ww.  j av a 2  s . c o  m*/
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
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.setFocus();
    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() {
        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.dltk.mod.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

/**
 * Overrides method in Dialog/*from   www.  j  a  v  a  2 s. c o  m*/
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
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.setFocus();
    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() {
        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.dltk.mod.ui.preferences.NewScriptProjectPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*from   ww w .  j av  a 2 s  . c o 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.NewScriptProjectPreferencePage_sourcefolder_label);

    int indent = 0;

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

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

    indent = convertWidthInCharsToPixels(4);

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

    //      String[] InterpreterEnvironmentNames= getInterpreterEnvironmentNames();
    //      if (InterpreterEnvironmentNames.length > 0) {
    //         Label InterpreterEnvironmentSelectionLabel= new Label(result, SWT.NONE);
    //         InterpreterEnvironmentSelectionLabel.setText(PreferencesMessages.NewScriptProjectPreferencePage_InterpreterEnvironmentlibrary_label); 
    //         InterpreterEnvironmentSelectionLabel.setLayoutData(new GridData());
    //      
    //         int index= getPreferenceStore().getInt(CLASSPATH_InterpreterEnvironmentLIBRARY_INDEX);
    //         fInterpreterEnvironmentCombo= new Combo(result, SWT.READ_ONLY);
    //         fInterpreterEnvironmentCombo.setItems(InterpreterEnvironmentNames);
    //         fInterpreterEnvironmentCombo.select(index);
    //         fInterpreterEnvironmentCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    //      }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:org.eclipse.dltk.mod.ui.text.completion.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in
 * the default content assist set and shows a link to the preferences.
 *//*from  ww w  .j a v  a  2s .co  m*/
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell();
        String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = ScriptTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                ScriptTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.eclipse.dltk.mod.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        close();
                        PreferencesUtil.createPreferenceDialogOn(shell,
                                "org.eclipse.dltk.mod.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                                .open();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        if (restoreId == dialog.open()) {
            IPreferenceStore store = getPreferenceStore();
            store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
            store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.dltk.ui.formatter.CreateProfileDialog.java

License:Open Source License

@Override
public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;//from  w w w  .  jav a2s .  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_profileName);
    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() {
        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_initSettings);
    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_openEditDialog);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

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

    fOpenEditDialog = true;
    fEditCheckbox.setSelection(fOpenEditDialog);

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

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.dltk.ui.formatter.FormatterModifyTabPage.java

License:Open Source License

public Composite createContents(IFormatterControlManager manager, Composite parent) {

    final int numColumns = 4;

    if (fPixelConverter == null) {
        fPixelConverter = new PixelConverter(parent);
    }/*from  w  ww. j a  va 2s .  co m*/

    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(1, 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);
    createOptions(manager, settingsPane);

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

    scroll.addControlListener(new ControlAdapter() {
        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);

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

From source file:org.eclipse.dltk.ui.preferences.EditTemplateDialog.java

License:Open Source License

protected Control createDialogArea(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from w  w  w. ja  v a  2 s.  c  om
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));

    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doTextWidgetChanged(e.widget);
        }
    };

    if (fIsNameModifiable) {
        createLabel(parent, PreferencesMessages.EditTemplateDialog_name);

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

        fNameText = createText(composite);
        fNameText.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {
            }

            public void focusLost(FocusEvent e) {
                if (fSuppressError) {
                    fSuppressError = false;
                    updateStatusAndButtons();
                }
            }
        });

        if (fIsContextTypeModifiable) {
            createLabel(composite, PreferencesMessages.EditTemplateDialog_context);
            fContextCombo = new Combo(composite, SWT.READ_ONLY);
            SWTUtil.setDefaultVisibleItemCount(fContextCombo);

            for (int i = 0; i < fContextTypes.length; i++) {
                fContextCombo.add(fContextTypes[i][1]);
            }

            fContextCombo.addModifyListener(listener);

            // fAutoInsertCheckbox = createCheckbox(composite,
            // PreferencesMessages.EditTemplateDialog_autoinsert);
            // fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable());
        }
    }

    createLabel(parent, PreferencesMessages.EditTemplateDialog_description);

    int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY;
    fDescriptionText = new Text(parent, descFlags);
    fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fDescriptionText.addModifyListener(listener);

    Label patternLabel = createLabel(parent, PreferencesMessages.EditTemplateDialog_pattern);
    patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    fPatternEditor = createEditor(parent);

    Label filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData());

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

    fInsertVariableButton = new Button(composite, SWT.NONE);
    fInsertVariableButton.setLayoutData(getButtonGridData());
    fInsertVariableButton.setText(PreferencesMessages.EditTemplateDialog_insert_variable);
    fInsertVariableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fPatternEditor.getTextWidget().setFocus();
            fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
        }

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

    fDescriptionText.setText(fTemplate.getDescription());
    if (fIsNameModifiable) {
        fNameText.setText(fTemplate.getName());
        fNameText.addModifyListener(listener);
        fContextCombo.select(getIndex(fTemplate.getContextTypeId()));
    } else {
        fPatternEditor.getControl().setFocus();
    }
    initializeActions();

    applyDialogFont(parent);
    return composite;
}