Example usage for org.eclipse.jface.preference FieldEditorPreferencePage FieldEditorPreferencePage

List of usage examples for org.eclipse.jface.preference FieldEditorPreferencePage FieldEditorPreferencePage

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FieldEditorPreferencePage FieldEditorPreferencePage.

Prototype

protected FieldEditorPreferencePage(int style) 

Source Link

Document

Creates a new field editor preference page with the given style, an empty title, and no image.

Usage

From source file:com.ge.research.sadl.ui.preferences.ReasonerConfigurationDialog.java

License:Open Source License

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

    editors = new ArrayList<FieldEditor>();
    messageArea = new DialogMessageArea();

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override/*w ww  .  java  2  s. c  om*/
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void createFieldEditors() {
            rcps = this.doGetPreferenceStore();
            if (rcps == null) {
                rcps = new PreferenceStore();
            }
            FieldEditor editor;
            if (config != null) {
                for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) {
                    String key = entry.getKey();
                    ConfigurationOption option = entry.getValue();
                    if (key.equalsIgnoreCase("builtin")) {
                        continue;
                    }
                    String optionDescription = option.getDescription();
                    Object currentValue = currentConfig.get(key);
                    Object optionValue = option.getValue();
                    if (currentValue != null) {
                        optionValue = currentValue;
                    }
                    logger.debug(key + " class = " + optionValue.getClass().getName());
                    Object[] optionPossibleValues = option.getPossibleValues();
                    if (optionPossibleValues != null && optionPossibleValues.length > 0) {
                        // Option has a list of values so create a dropdown box
                        String[][] nv = new String[optionPossibleValues.length][2];
                        for (int i = 0; i < optionPossibleValues.length; i++) {
                            nv[i][0] = optionPossibleValues[i].toString();
                            nv[i][1] = optionPossibleValues[i].toString();
                        }
                        editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent());
                        rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                        editor.setPreferenceStore(rcps);
                        addField(editor);
                        editor.load();
                        editors.add(editor);
                    } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) {
                        editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                        rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                        editor.setPreferenceStore(rcps);
                        addField(editor);
                        editor.load();
                        editors.add(editor);
                    } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) {
                        editor = new BooleanFieldEditor(key, optionDescription,
                                BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent());
                        rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                        editor.setPreferenceStore(rcps);
                        addField(editor);
                        editor.load();
                        editors.add(editor);
                    } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) {
                        editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent());
                        rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                        editor.setPreferenceStore(rcps);
                        addField(editor);
                        editor.setPage(page);
                        editor.load();
                        editors.add(editor);
                    } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) {
                        editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent());
                        rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                        editor.setPreferenceStore(rcps);
                        addField(editor);
                        editor.load();
                        editors.add(editor);
                    }
                }
            } else {
                logger.info("No configuration options available");
            }
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

    };

    messageArea.createContents(composite);
    messageArea.showTitle(reasonerCategory + " Configuration Options", null);
    messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH));
    page.createControl(composite);
    for (FieldEditor editor : editors) {
        editor.setPreferenceStore(rcps);
    }
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:com.ge.research.sadl.ui.preferences.TranslatorConfigurationDialog.java

License:Open Source License

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

    editors = new ArrayList<FieldEditor>();
    messageArea = new DialogMessageArea();

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override/*from w w w  .jav  a 2  s  .  c  o m*/
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void createFieldEditors() {
            rcps = this.doGetPreferenceStore();
            if (rcps == null) {
                rcps = new PreferenceStore();
            }
            FieldEditor editor;
            if (config == null) {
                messageArea.updateText("No options available", IMessageProvider.NONE);
                return;
            }
            for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) {
                String key = entry.getKey();
                ConfigurationOption option = entry.getValue();
                if (key.equalsIgnoreCase("builtin")) {
                    continue;
                }
                String optionDescription = option.getDescription();
                Object currentValue = currentConfig.get(key);
                Object optionValue = option.getValue();
                if (currentValue != null) {
                    optionValue = currentValue;
                }
                logger.debug(
                        key + " class = " + (optionValue != null ? optionValue.getClass().getName() : "null"));
                Object[] optionPossibleValues = option.getPossibleValues();
                if (optionPossibleValues != null && optionPossibleValues.length > 0) {
                    // Option has a list of values so create a dropdown box
                    String[][] nv = new String[optionPossibleValues.length][2];
                    for (int i = 0; i < optionPossibleValues.length; i++) {
                        nv[i][0] = optionPossibleValues[i].toString();
                        nv[i][1] = optionPossibleValues[i].toString();
                    }
                    editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue == null) {
                    editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) {
                    editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) {
                    editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL,
                            getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) {
                    editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.setPage(page);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) {
                    editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                }
            }
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

    };

    messageArea.createContents(composite);
    messageArea.showTitle(translatorCategory + " Configuration Options", null);
    messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH));
    page.createControl(composite);
    for (FieldEditor editor : editors) {
        editor.setPreferenceStore(rcps);
    }
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:com.ge.research.sadl.ui.properties.ReasonerConfigurationDialog.java

License:Open Source License

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

    editors = new ArrayList<FieldEditor>();
    messageArea = new DialogMessageArea();

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override/*from ww w  . j a va 2  s.  co m*/
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void createFieldEditors() {
            rcps = this.doGetPreferenceStore();
            if (rcps == null) {
                rcps = new PreferenceStore();
            }
            FieldEditor editor;
            for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) {
                String key = entry.getKey();
                ConfigurationOption option = entry.getValue();
                if (key.equalsIgnoreCase("builtin")) {
                    continue;
                }
                String optionDescription = option.getDescription();
                Object currentValue = currentConfig.get(key);
                Object optionValue = option.getValue();
                if (currentValue != null) {
                    optionValue = currentValue;
                }
                logger.debug(key + " class = " + optionValue.getClass().getName());
                Object[] optionPossibleValues = option.getPossibleValues();
                if (optionPossibleValues != null && optionPossibleValues.length > 0) {
                    // Option has a list of values so create a dropdown box
                    String[][] nv = new String[optionPossibleValues.length][2];
                    for (int i = 0; i < optionPossibleValues.length; i++) {
                        nv[i][0] = optionPossibleValues[i].toString();
                        nv[i][1] = optionPossibleValues[i].toString();
                    }
                    editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) {
                    editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) {
                    editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL,
                            getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) {
                    editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.setPage(page);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) {
                    editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                }
            }
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

    };

    messageArea.createContents(composite);
    messageArea.showTitle(reasonerCategory + " Configuration Options", null);
    messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH));
    page.createControl(composite);
    for (FieldEditor editor : editors) {
        editor.setPreferenceStore(rcps);
    }
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:com.ge.research.sadl.ui.properties.TranslatorConfigurationDialog.java

License:Open Source License

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

    editors = new ArrayList<FieldEditor>();
    messageArea = new DialogMessageArea();

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override/*ww  w  .  j  ava  2  s  . co m*/
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void createFieldEditors() {
            rcps = this.doGetPreferenceStore();
            if (rcps == null) {
                rcps = new PreferenceStore();
            }
            FieldEditor editor;
            if (config == null) {
                messageArea.updateText("No options available", IMessageProvider.NONE);
                return;
            }
            for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) {
                String key = entry.getKey();
                ConfigurationOption option = entry.getValue();
                if (key.equalsIgnoreCase("builtin")) {
                    continue;
                }
                String optionDescription = option.getDescription();
                Object currentValue = currentConfig.get(key);
                Object optionValue = option.getValue();
                if (currentValue != null) {
                    optionValue = currentValue;
                }
                logger.debug(key + " class = " + optionValue.getClass().getName());
                Object[] optionPossibleValues = option.getPossibleValues();
                if (optionPossibleValues != null && optionPossibleValues.length > 0) {
                    // Option has a list of values so create a dropdown box
                    String[][] nv = new String[optionPossibleValues.length][2];
                    for (int i = 0; i < optionPossibleValues.length; i++) {
                        nv[i][0] = optionPossibleValues[i].toString();
                        nv[i][1] = optionPossibleValues[i].toString();
                    }
                    editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) {
                    editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) {
                    editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL,
                            getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) {
                    editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.setPage(page);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) {
                    editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                }
            }
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

    };

    messageArea.createContents(composite);
    messageArea.showTitle(translatorCategory + " Configuration Options", null);
    messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH));
    page.createControl(composite);
    for (FieldEditor editor : editors) {
        editor.setPreferenceStore(rcps);
    }
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:eclox.core.ui.CustomDoxygenDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override/*from  w ww . ja  va 2s  . co  m*/
        protected void createFieldEditors() {
            targetDirectoryEditor = new DirectoryFieldEditor("", "Custom Doxygen directory:",
                    getFieldEditorParent()) {
                /** The own control is the variableButton */
                private static final int NUMBER_OF_OWN_CONTROLS = 1;

                @Override
                protected boolean doCheckState() {
                    String dirName = getTextControl().getText();
                    dirName = dirName.trim();
                    if (dirName.length() == 0 && isEmptyStringAllowed())
                        return true;
                    IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
                    String substitutedDirName;
                    try {
                        substitutedDirName = manager.performStringSubstitution(dirName);
                    } catch (CoreException e) {
                        // It's apparently invalid
                        return false;
                    }
                    File dir = new File(substitutedDirName);
                    // require the file to exist
                    return dir.exists() && dir.isDirectory();
                }

                @Override
                public int getNumberOfControls() {
                    return super.getNumberOfControls() + NUMBER_OF_OWN_CONTROLS;
                }

                @Override
                protected void doFillIntoGrid(Composite parent, int numColumns) {
                    super.doFillIntoGrid(parent, numColumns - NUMBER_OF_OWN_CONTROLS);
                }

                @Override
                protected void adjustForNumColumns(int numColumns) {
                    super.adjustForNumColumns(numColumns - NUMBER_OF_OWN_CONTROLS);
                }

                @Override
                protected void createControl(Composite parent) {
                    // setting validate strategy using the setter method is too late
                    super.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
                    super.createControl(parent);
                    if (hasDebugUiBundle()) {
                        addVariablesButton(parent);
                    }
                }

                private void addVariablesButton(Composite parent) {
                    Button variableButton = new Button(parent, SWT.PUSH);
                    variableButton.setText("&Variable...");
                    variableButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            org.eclipse.debug.ui.StringVariableSelectionDialog dialog = new org.eclipse.debug.ui.StringVariableSelectionDialog(
                                    getShell());
                            int returnCode = dialog.open();
                            if (returnCode == Window.OK)
                                setStringValue(dialog.getVariableExpression());
                        }
                    });
                }
            };
            targetDirectoryEditor.setStringValue(targetDirectory == null ? "" : targetDirectory);
            addField(targetDirectoryEditor);
        }

        @Override
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

        // @Override
        // protected void createButtonsForButtonBar(Composite parent) {
        // super.createButtonsForButtonBar(parent);
        // updateButtons(page.isValid());
        // }
        private void updateButtons(boolean isValid) {
            Button okButton = getButton(IDialogConstants.OK_ID);
            if (okButton != null) {
                okButton.setEnabled(isValid);
            }
        }
    };
    page.createControl(composite);
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:hu.bme.mit.massif.simulink.importer.ui.dialogs.AbstractSimulinkSettingsDialog.java

License:Open Source License

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

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override// w w w . j av  a2s .  c o  m
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @Override
        protected void createFieldEditors() {
            Composite fieldEditorParent = getFieldEditorParent();
            targetDirectoryEditor = new ContainerFieldEditor("", "Target directory:", fieldEditorParent);
            targetDirectoryEditor.setEmptyStringAllowed(false);
            targetDirectoryEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
            targetDirectoryEditor.setStringValue(targetDirectory.getPath());
            addField(targetDirectoryEditor);

            List<? extends FieldEditor> additionalFields = additionalFields(fieldEditorParent);
            for (FieldEditor fieldEditor : additionalFields) {
                addField(fieldEditor);
            }
        }

        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }
    };

    page.createControl(composite);
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:org.eclipse.cdt.codan.internal.ui.widgets.ParametersComposite.java

License:Open Source License

/**
 * @param parent/*ww w  .j a va2  s .co m*/
 * @param problem
 * @param style
 */
public ParametersComposite(Composite parent, final IProblem problem) {
    super(parent, SWT.NONE);
    if (problem == null)
        throw new NullPointerException();
    this.setLayout(new GridLayout(2, false));
    this.problem = problem;
    this.prefStore = new PreferenceStore();
    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override
        protected void createFieldEditors() {
            noDefaultAndApplyButton();
            ((GridLayout) getFieldEditorParent().getLayout()).numColumns = 2;
            addField(new BooleanFieldEditor(PREF_ENABLED, CodanUIMessages.ParametersComposite_IsEnabled,
                    getFieldEditorParent()));
            String[][] entries = {
                    { CodanSeverity.Error.toTranslatableString(), CodanSeverity.Error.toString() }, //
                    { CodanSeverity.Warning.toTranslatableString(), CodanSeverity.Warning.toString() }, //
                    { CodanSeverity.Info.toTranslatableString(), CodanSeverity.Info.toString() }, //
                    { NO_CHANGE, NO_CHANGE }, //
            };
            addField(new ComboFieldEditor(PREF_SEVERITY, CodanUIMessages.ParametersComposite_Severity, entries,
                    getFieldEditorParent()));
            StringFieldEditor messagePatternEditor = new StringFieldEditor(PREF_MESSAGE,
                    CodanUIMessages.ParametersComposite_MessagePattern, getFieldEditorParent());
            // We are using read-only text field for message pattern to allow copy to clipboard.
            makeUneditable(messagePatternEditor);
            addField(messagePatternEditor);
            IProblemPreference pref = problem.getPreference();
            createFieldEditorsForParameters(pref);
        }

        private void makeUneditable(StringFieldEditor editor) {
            /*
             * Here we are doing 2 things to make a text control "uneditable":
             * 1. 'setUneditable(false)' the problem with with just doing this is that
             *    the background of the text control doesn't change, and it looks like
             *    an editable one. This is confusing to the user.
             * 2. Getting the background of a label control and applying it
             *    to the "uneditable" text control. This way it is easier to figure out that
             *    the contents of the text control cannot be changed.
             * Why not just setEnable(false)? Because it changes the text of the text control
             * to light gray, making it difficult to read. Also, users cannot select and copy
             * text from a disabled text field.
             */
            Color background = editor.getLabelControl(getFieldEditorParent()).getBackground();
            Text text = editor.getTextControl(getFieldEditorParent());
            text.setBackground(background);
            text.setEditable(false);
        }

        @Override
        protected Control createContents(Composite parent) {
            return super.createContents(parent);
        }

        /**
         * @param info
         */
        private void createFieldEditorsForParameters(final IProblemPreference info) {
            if (info == null)
                return;
            if (info.getKey() == FileScopeProblemPreference.KEY)
                return; // skip the scope
            if (info.getKey() == LaunchModeProblemPreference.KEY)
                return; // skip the launch
            switch (info.getType()) {
            case TYPE_STRING: {
                StringFieldEditor fe = new StringFieldEditor(info.getQualifiedKey(), info.getLabel(),
                        getFieldEditorParent());
                addField(fe);
                break;
            }
            case TYPE_BOOLEAN: {
                BooleanFieldEditor fe = new BooleanFieldEditor(info.getQualifiedKey(), info.getLabel(),
                        getFieldEditorParent());
                addField(fe);
                break;
            }
            case TYPE_LIST:
                ListEditor le = new ListEditor(info.getQualifiedKey(), info.getLabel(),
                        getFieldEditorParent()) {
                    @Override
                    protected String[] parseString(String stringList) {
                        ListProblemPreference list = (ListProblemPreference) info;
                        IProblemPreference[] childDescriptors = list.getChildDescriptors();
                        if (childDescriptors.length == 0)
                            return new String[0];
                        String res[] = new String[childDescriptors.length];
                        for (int i = 0; i < childDescriptors.length; i++) {
                            IProblemPreference item = childDescriptors[i];
                            res[i] = String.valueOf(item.getValue());
                        }
                        return res;
                    }

                    @Override
                    protected String getNewInputObject() {
                        ListProblemPreference list = (ListProblemPreference) info;
                        String label = list.getChildDescriptor().getLabel();
                        InputDialog dialog = new InputDialog(getShell(),
                                CodanUIMessages.ParametersComposite_NewValue, label, "", null); //$NON-NLS-1$
                        if (dialog.open() == Window.OK) {
                            return dialog.getValue();
                        }
                        return null;
                    }

                    @Override
                    protected String createList(String[] items) {
                        ListProblemPreference list = (ListProblemPreference) info.clone();
                        list.clear();
                        for (int i = 0; i < items.length; i++) {
                            String val = items[i];
                            list.addChildValue(val);
                        }
                        return list.exportValue();
                    }
                };
                addField(le);
                break;
            case TYPE_MAP:
                IProblemPreference[] childrenDescriptor = ((IProblemPreferenceCompositeDescriptor) info)
                        .getChildDescriptors();
                for (int i = 0; i < childrenDescriptor.length; i++) {
                    IProblemPreference desc = childrenDescriptor[i];
                    createFieldEditorsForParameters(desc);
                }
                break;
            case TYPE_CUSTOM: {
                StringFieldEditor fe = new StringFieldEditor(info.getQualifiedKey(), info.getLabel(),
                        getFieldEditorParent());
                addField(fe);
                break;
            }
            case TYPE_FILE: {
                FileFieldEditor fe = new FileFieldEditor(info.getQualifiedKey(), info.getLabel(),
                        getFieldEditorParent());
                addField(fe);
                break;
            }
            default:
                throw new UnsupportedOperationException(info.getType().toString());
            }
        }
    };
    load(problem);
    page.setPreferenceStore(prefStore);
    page.createControl(parent);
    page.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}