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:ext.org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//w ww .  j a v a  2s .  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.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.refactoring.PullUpMemberPage.java

License:Open Source License

private void createButtonComposite(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    final GridLayout gl = new GridLayout();
    gl.marginHeight = 0;/*from w  ww.ja v  a2s.c  o m*/
    gl.marginWidth = 0;
    composite.setLayout(gl);

    fSelectAllButton = new Button(composite, SWT.PUSH);
    fSelectAllButton.setText(RefactoringMessages.PullUpWizard_select_all_label);
    fSelectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fSelectAllButton.setEnabled(true);
    SWTUtil.setButtonDimensionHint(fSelectAllButton);
    fSelectAllButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            final IMember[] members = getMembers();
            setActionForMembers(members, PULL_UP_ACTION);
            updateWizardPage(null, true);
        }
    });

    fDeselectAllButton = new Button(composite, SWT.PUSH);
    fDeselectAllButton.setText(RefactoringMessages.PullUpWizard_deselect_all_label);
    fDeselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fDeselectAllButton.setEnabled(false);
    SWTUtil.setButtonDimensionHint(fDeselectAllButton);
    fDeselectAllButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            final IMember[] members = getMembers();
            setActionForMembers(members, MemberActionInfo.NO_ACTION);
            updateWizardPage(null, true);
        }
    });

    fEditButton = new Button(composite, SWT.PUSH);
    fEditButton.setText(RefactoringMessages.PullUpInputPage1_Edit);

    final GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = new PixelConverter(parent)
            .convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    fEditButton.setLayoutData(data);
    fEditButton.setEnabled(false);
    SWTUtil.setButtonDimensionHint(fEditButton);
    fEditButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            editSelectedMembers();
        }
    });

    fAddButton = new Button(composite, SWT.PUSH);
    fAddButton.setText(RefactoringMessages.PullUpInputPage1_Add_Required);
    fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    SWTUtil.setButtonDimensionHint(fAddButton);
    fAddButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            checkAdditionalRequired();
        }
    });
}

From source file:ext.org.eclipse.jdt.internal.ui.text.java.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.
 *
 * @return  <code>true</code> if the default should be restored
 * @since 3.3/*  w  w  w .  ja v  a2s.co  m*/
 */
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = JavaPlugin.getActiveWorkbenchShell();
        String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = JavaTextMessages.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(
                JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        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.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            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() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                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;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            @Override
            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);
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:fede.plugin.workspace.filters.CustomFiltersDialog.java

License:Apache License

/**
 * Overrides method in Dialog/*from ww w .j  a v a  2  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.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() {
        @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:gov.nasa.ensemble.core.plan.editor.lifecycle.TransferableFilePlanChooser.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // Make view// ww  w.  java  2s  . c om
    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));
    // Make file dialog
    FileDialog fileDialog = new FileDialog(parent.getShell(), SWT.OPEN);
    fileDialog.setText("Open");
    // the current workspace
    String path = Platform.getInstanceLocation().getURL().getPath();
    fileDialog.setFilterPath(path);
    //        fileDialog.setFilterPath(System.getProperty("user.dir"));
    String[] filterExt = { "*.spife", "*.*" };
    fileDialog.setFilterExtensions(filterExt);
    selectedFileName = fileDialog.open();
    //  if (selectedFileName == null)
    return null;
}

From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite root) {
    final Composite composite = new Composite(root, SWT.NONE);
    final 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.  java2 s .  c  o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    final GridLayout gridLayout = new GridLayout(3, false);
    final GridDataFactory textFactory = GridDataFactory.fillDefaults().grab(true, false).span(2, 1);
    final GridData data;

    final Group domainManagerGroup = new Group(composite, SWT.NULL);

    domainManagerGroup.setText("Domain Manager");
    domainManagerGroup.setLayout(gridLayout);
    domainManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Label label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Domain Name: ");
    Text text = new Text(domainManagerGroup, SWT.BORDER);
    data = textFactory.create();
    data.horizontalSpan = 2;
    text.setLayoutData(data);
    this.nameBinding = this.context.bindValue(SWTObservables.observeText(text, SWT.Modify),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DOMAIN_NAME),
            new UpdateValueStrategy().setAfterConvertValidator(this.nameValidator), null);
    text.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            updateButtonsEnableState((IStatus) LaunchDomainManagerWithOptionsDialog.this.nameBinding
                    .getValidationStatus().getValue());
        }
    });

    ControlDecorationSupport.create(this.nameBinding, SWT.TOP | SWT.LEFT);

    label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Debug Level: ");
    ComboViewer debugViewer = new ComboViewer(domainManagerGroup,
            SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER);
    debugViewer.setLabelProvider(new LabelProvider());
    debugViewer.setContentProvider(new ArrayContentProvider());
    debugViewer.setInput(DebugLevel.values());
    debugViewer.getControl().setLayoutData(data);
    this.context.bindValue(ViewersObservables.observeSingleSelection(debugViewer),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DEBUG_LEVEL));

    label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Arguments:");
    text = new Text(domainManagerGroup, SWT.BORDER);
    text.setLayoutData(data);
    this.context.bindValue(SWTObservables.observeText(text, SWT.Modify),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_ARGUMENTS));

    final Group deviceManagerGroup = new Group(composite, SWT.NULL);

    deviceManagerGroup.setText("Device Manager");
    deviceManagerGroup.setLayout(GridLayoutFactory.fillDefaults().create());
    deviceManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    deviceManagerGroup.setVisible(!this.sdrRoot.getNodesContainer().getNodes().isEmpty());

    final CheckboxTreeViewer treeViewer = createTreeViewer(deviceManagerGroup);
    treeViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final Control buttonComposite = createSelectionButtons(deviceManagerGroup);
    buttonComposite.setLayoutData(GridDataFactory.fillDefaults().create());

    context.bindSet(ViewersObservables.observeCheckedElements(treeViewer, DeviceConfiguration.class), nodes);

    // Insert a progress monitor
    this.progressMonitorPart = createProgressMonitorPart(composite, new GridLayout());
    final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    this.progressMonitorPart.setLayoutData(gridData);
    this.progressMonitorPart.setVisible(false);

    // Build the separator line
    final Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Dialog.applyDialogFont(composite);

    getShell().getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
            try {
                LaunchDomainManagerWithOptionsDialog.this.run(true, true, scanForTakenDomainNames);
                updateButtonsEnableState(Status.OK_STATUS);
            } catch (final InvocationTargetException e) {
                SdrUiPlugin.getDefault().getLog().log(
                        new Status(IStatus.ERROR, SdrUiPlugin.PLUGIN_ID, "Error scanning for domain names", e));
            } catch (final InterruptedException e) {
                updateButtonsEnableState(Status.OK_STATUS);
            }
        }
    });

    return composite;
}

From source file:hydrograph.ui.parametergrid.dialog.ParamterValueDialog.java

License:Apache License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size./*  w  ww. j a  v  a2s  . c  o  m*/
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN - 4);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING - 2);

    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);

    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Add the buttons to the button bar.
    createButtonsForButtonBar(composite);
    return composite;
}

From source file:ilg.gnumcueclipse.core.ui.preferences.McuPreferencesPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//  w  w  w. ja v a  2 s. c  o 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);

    Dialog.applyDialogFont(container);
    return container;
}

From source file:melnorme.util.swt.MetricsUtil.java

License:Open Source License

/** Initializes a layout with dialog unit settings. 
 * @param testControl the control used to obtain FontMetrics. */
public static void initGridLayoutWithDLUs(GridLayout layout, Control testControl) {

    FontMetrics fontMetrics = getFontMetrics(testControl);

    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.VERTICAL_SPACING);
    layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
}

From source file:msi.gama.lang.gaml.ui.templates.GamlEditTemplateDialog.java

@Override
protected Control createDialogArea(final Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from   w  w  w  .  j a  v a2s  .  com*/
    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() {

        @Override
        public void modifyText(final ModifyEvent e) {
            doTextWidgetChanged(e.widget);
        }
    };

    createLabel(parent, TemplateDialogMessages.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);

    createLabel(composite, "Category:");
    Label category = new Label(composite, SWT.NONE);

    // category.addModifyListener(listener);

    createLabel(parent, TemplateDialogMessages.EditTemplateDialog_description);

    fDescriptionText = new Text(parent, SWT.BORDER);
    fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fDescriptionText.addModifyListener(listener);

    Label patternLabel = createLabel(parent, TemplateDialogMessages.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 = 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(TemplateDialogMessages.EditTemplateDialog_insert_variable);
    fInsertVariableButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            fPatternEditor.getTextWidget().setFocus();
            fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
        }

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

    fDescriptionText.setText(data.getTemplate().getDescription());
    fillMenuPath(category);
    fNameText.setText(data.getTemplate().getName());
    fNameText.addModifyListener(listener);
    applyDialogFont(parent);
    return composite;
}