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

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

Introduction

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

Prototype

public StringFieldEditor(String name, String labelText, Composite parent) 

Source Link

Document

Creates a string field editor of unlimited width.

Usage

From source file:jp.littleforest.pathtools.preferences.PathToolsPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new StringFieldEditor(P_OPEN_FOLDER_CMD, "????",
            getFieldEditorParent()));//from w w w  . j  av a  2  s . c om
    addField(new StringFieldEditor(P_OPEN_PROMPT_CMD,
            "????", getFieldEditorParent()));
}

From source file:jp.sourceforge.tmdmaker.ui.preferences.rule.RulePreferencePage.java

License:Apache License

/**
 * /*from w  w  w.ja va2  s  . c  o  m*/
 * {@inheritDoc}
 * 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override
protected void createFieldEditors() {
    addField(new StringFieldEditor(RulePreferenceConstants.P_IDENTIFIER_SUFFIXES, Messages.IdentifierSuffixes,
            getFieldEditorParent()));
    addField(new StringFieldEditor(RulePreferenceConstants.P_REPORT_SUFFIXES, Messages.ReportSuffixes,
            getFieldEditorParent()));
    BooleanFieldEditor forenKeyEnabledEdior = new BooleanFieldEditor(
            RulePreferenceConstants.P_FOREIGN_KEY_ENABLED, Messages.GenerateForeignKeyConstraint,
            getFieldEditorParent());
    addField(forenKeyEnabledEdior);
}

From source file:kieker.develop.rl.ui.preferences.AbstractFieldEditorOverlayPage.java

License:Apache License

@Override
protected void createFieldEditors() {
    for (final AbstractOutletConfiguration<ComplexType, Object> outletConfiguration : GeneratorRegistration
            .getOutletConfigurations()) {
        this.addField(
                new BooleanFieldEditor(TargetsPreferences.GENERATOR_ACTIVE + outletConfiguration.getName(),
                        outletConfiguration.getDescription() + " generator", this.getFieldEditorParent()));
        final FieldEditor commentFieldEditor = new CommentFieldEditor(
                TargetsPreferences.GENERATOR_HEADER_COMMENT + outletConfiguration.getName(), "Header",
                this.getFieldEditorParent());
        this.addField(commentFieldEditor);
    }/*from  w  ww.  j a  v a 2 s. c  o m*/

    // SpacerFieldEditor spacer = new SpacerFieldEditor(getFieldEditorParent());
    // addField(spacer);

    this.addField(new StringFieldEditor(TargetsPreferences.AUTHOR_NAME, "Author", this.getFieldEditorParent()));
    this.addField(new StringFieldEditor(TargetsPreferences.VERSION_ID, "Default Version",
            this.getFieldEditorParent()));
    this.addField(new StringFieldEditor(TargetsPreferences.TARGET_VERSION, "Target Version",
            this.getFieldEditorParent()));
}

From source file:metabest.preferences.MetaBestPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself./*from   ww  w. j  a  v a2  s .co m*/
 */
public void createFieldEditors() {

    addField(new BooleanFieldEditor(MetaBestPreferenceConstants.FAST_PERMUTATION_CHECK,
            "Optimize results calculation when launching permutted assertions (unchecking it might affect execution time)",
            getFieldEditorParent()));

    addField(new StringFieldEditor(MetaBestPreferenceConstants.MISSING_ASSERTION_LITERAL,
            "Missing element literal for sketches", getFieldEditorParent()));

    addField(new StringFieldEditor(MetaBestPreferenceConstants.UNKNOWN_ASSERTION_LITERAL,
            "Unknown element literal for sketches", getFieldEditorParent()));
}

From source file:metabup.annotations.general.preferences.AnnotationsPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.//from  ww  w. j ava  2  s.c o m
 */
public void createFieldEditors() {
    AnnotationFactory af = new AnnotationFactory();
    af.initializeFactory();
    createSpace();

    for (String ann : af.listAllAnnotationsNames()) {
        Class<? extends IAnnotation> annotationClass = af.getAnnotation(ann);
        try {
            IAnnotation annotation = annotationClass.newInstance();
            HashMap<String, Object> preferences = annotation.getPreferences();

            if (preferences != null && !preferences.isEmpty()) {
                Label label = new Label(getFieldEditorParent(), SWT.BOLD);
                GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                gd.horizontalSpan = 2;
                label.setLayoutData(gd);
                label.setText("@" + ann);
                Iterator it = preferences.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry e = (Map.Entry) it.next();
                    if (e.getValue() instanceof String)
                        addField(new StringFieldEditor((String) e.getKey(), (String) e.getKey(),
                                getFieldEditorParent()));
                    else if (e.getValue() instanceof Boolean)
                        addField(new BooleanFieldEditor((String) e.getKey(), (String) e.getKey(),
                                getFieldEditorParent()));
                    /* radio group (multi-option) preferences should be furtherly approached */
                }

                createSpace();
            }
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InstantiationException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
    }

    /*addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, 
    "&Directory preference:", getFieldEditorParent()));*/
    /*addField(
       new BooleanFieldEditor(
    PreferenceConstants.P_BOOLEAN,
    "&An example of a boolean preference",
    getFieldEditorParent()));*/

    /*addField(new RadioGroupFieldEditor(
    PreferenceConstants.P_CHOICE,
       "An example of a multiple-choice preference",
       1,
       new String[][] { { "&Choice 1", "choice1" }, {
    "C&hoice 2", "choice2" }
    }, getFieldEditorParent()));*/
    /*addField(
       new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));*/
}

From source file:metabup.assistance.preferences.AssistanceTipsPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.// w ww. j ava 2  s  . c  o m
 */
public void createFieldEditors() {
    AssistanceTipsFactory af = new AssistanceTipsFactory();
    af.initializeFactory();
    createSpace();

    for (String at : af.listAllAssistanceTipNames()) {
        Class<? extends IAssistanceTip> tipClass = af.getAssistanceTip(at);
        try {
            IAssistanceTip annotation = tipClass.newInstance();
            HashMap<String, Object> preferences = annotation.getPreferences();

            if (preferences != null && !preferences.isEmpty()) {
                Label label = new Label(getFieldEditorParent(), SWT.BOLD);
                GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                gd.horizontalSpan = 2;
                label.setLayoutData(gd);
                label.setText(annotation.getName());
                Iterator it = preferences.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry e = (Map.Entry) it.next();
                    if (e.getValue() instanceof String)
                        addField(new StringFieldEditor((String) e.getKey(), (String) e.getKey(),
                                getFieldEditorParent()));
                    else if (e.getValue() instanceof Boolean)
                        addField(new BooleanFieldEditor((String) e.getKey(), (String) e.getKey(),
                                getFieldEditorParent()));
                    else if (e.getValue() instanceof List<?>) {
                        List<?> values = (List<?>) e.getValue();

                        String strVals[][] = new String[values.size()][2];

                        for (int i = 0; i < values.size(); i++) {
                            strVals[i][0] = values.get(i).toString();
                            strVals[i][1] = values.get(i).toString();
                        }

                        addField(new RadioGroupFieldEditor((String) e.getKey(), (String) e.getKey(), 1, strVals,
                                getFieldEditorParent()));
                    }

                    /* radio group (multi-option) preferences should be furtherly approached */
                }

                createSpace();
            }
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InstantiationException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
    }

    /*addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, 
    "&Directory preference:", getFieldEditorParent()));*/
    /*addField(
       new BooleanFieldEditor(
    PreferenceConstants.P_BOOLEAN,
    "&An example of a boolean preference",
    getFieldEditorParent()));*/

    /*addField(new RadioGroupFieldEditor(
    PreferenceConstants.P_CHOICE,
       "An example of a multiple-choice preference",
       1,
       new String[][] { { "&Choice 1", "choice1" }, {
    "C&hoice 2", "choice2" }
    }, getFieldEditorParent()));*/
    /*addField(
       new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));*/
}

From source file:metabup.preferences.PreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself./*ww  w. j ava2s .c o m*/
 */
public void createFieldEditors() {
    /*addField(new DirectoryFieldEditor(PreferenceConstants.P_COLLABORO_USERNAME, 
    "&Collaboro username:", getFieldEditorParent()));
    addField(
       new BooleanFieldEditor(
    PreferenceConstants.P_BOOLEAN,
    "&An example of a boolean preference",
    getFieldEditorParent()));
            
    addField(new RadioGroupFieldEditor(
    PreferenceConstants.P_CHOICE,
       "An example of a multiple-choice preference",
       1,
       new String[][] { { "&Choice 1", "choice1" }, {
    "C&hoice 2", "choice2" }
    }, getFieldEditorParent()));*/
    addField(new StringFieldEditor(PreferenceConstants.P_COLLABORO_USERNAME, "&Collaboro username:",
            getFieldEditorParent()));
}

From source file:mpj_express_debugger.JavaConnectTab.java

License:Open Source License

/**
 * Update the argument area to show the selected connector's arguments
 *//*w  w w  .j a  v  a2 s.  c o  m*/
private void handleConnectorComboModified() {
    int index = fConnectorCombo.getSelectionIndex();
    if ((index < 0) || (index >= fConnectors.length)) {
        return;
    }
    IVMConnector vm = fConnectors[index];
    if (vm.equals(fConnector)) {
        return; // selection did not change
    }
    fConnector = vm;
    try {
        fArgumentMap = vm.getDefaultArguments();
    } catch (CoreException e) {
        JDIDebugUIPlugin.statusDialog(LauncherMessages.JavaConnectTab_Unable_to_display_connection_arguments__2,
                e.getStatus());
        return;
    }

    // Dispose of any current child widgets in the tab holder area
    Control[] children = fArgumentComposite.getChildren();
    for (int i = 0; i < children.length; i++) {
        children[i].dispose();
    }
    fFieldEditorMap.clear();
    store = new PreferenceStore();

    Iterator keys = vm.getArgumentOrder().iterator();

    while (keys.hasNext()) {
        String key = (String) keys.next();

        arg = (Connector.Argument) fArgumentMap.get(key);

        if (arg instanceof Connector.IntegerArgument) {
            store.setDefault(arg.name(), ((Connector.IntegerArgument) arg).intValue());
            field = new IntegerFieldEditor(arg.name(), getLabel(arg.label()), fArgumentComposite);

        } else if (arg instanceof Connector.SelectedArgument) {
            List choices = ((Connector.SelectedArgument) arg).choices();
            String[][] namesAndValues = new String[choices.size()][2];
            Iterator iter = choices.iterator();
            int count = 0;

            while (iter.hasNext()) {
                String choice = (String) iter.next();
                namesAndValues[count][0] = choice;
                namesAndValues[count][1] = choice;
                count++;
            }
            store.setDefault(arg.name(), arg.value());
            field = new ComboFieldEditor(arg.name(), getLabel(arg.label()), namesAndValues, fArgumentComposite);
        } else if (arg instanceof Connector.StringArgument) {

            store.setDefault(arg.name(), arg.value());

            if (arg.name().equals("confFile")) {

                field = new FileFieldEditor(arg.name(), getLabel(arg.label()), fArgumentComposite);
            } else
                field = new StringFieldEditor(arg.name(), getLabel(arg.label()), fArgumentComposite);
        } else if (arg instanceof Connector.BooleanArgument) {
            store.setDefault(arg.name(), ((Connector.BooleanArgument) arg).booleanValue());
            field = new BooleanFieldEditor(arg.name(), getLabel(arg.label()), fArgumentComposite);
        }
        if (field != null) {
            field.setPreferenceStore(store);
            field.loadDefault();
            field.setPropertyChangeListener(this);
            fFieldEditorMap.put(key, field);
        }
    }
    fArgumentComposite.getParent().getParent().layout();
    fArgumentComposite.layout(true);
    updateLaunchConfigurationDialog();
}

From source file:mpj_express_debugger.JavaMPJConnectTab.java

License:Open Source License

/**
 * Update the argument area to show the selected connector's arguments
 */// w  w w  .  j a v  a2s .  c  o m
private void handleConnectorComboModified() {
    int index = fConnectorCombo.getSelectionIndex();
    if ((index < 0) || (index >= fConnectors.length)) {
        return;
    }
    IVMConnector vm = fConnectors[index];
    if (vm.equals(fConnector)) {
        return; // selection did not change
    }
    fConnector = vm;
    try {
        fArgumentMap = vm.getDefaultArguments();
    } catch (CoreException e) {
        JDIDebugUIPlugin.statusDialog(LauncherMessages.JavaConnectTab_Unable_to_display_connection_arguments__2,
                e.getStatus());
        return;
    }

    // Dispose of any current child widgets in the tab holder area
    Control[] children = fArgumentComposite.getChildren();
    for (int i = 0; i < children.length; i++) {
        children[i].dispose();
    }
    fFieldEditorMap.clear();
    PreferenceStore store = new PreferenceStore();
    // create editors
    Iterator keys = vm.getArgumentOrder().iterator();
    while (keys.hasNext()) {
        String key = (String) keys.next();
        Connector.Argument arg = (Connector.Argument) fArgumentMap.get(key);
        FieldEditor field = null;
        if (arg instanceof Connector.IntegerArgument) {
            store.setDefault(arg.name(), ((Connector.IntegerArgument) arg).intValue());
            field = new IntegerFieldEditor(arg.name(), arg.label(), fArgumentComposite);
        } else if (arg instanceof Connector.SelectedArgument) {
            List choices = ((Connector.SelectedArgument) arg).choices();
            String[][] namesAndValues = new String[choices.size()][2];
            Iterator iter = choices.iterator();
            int count = 0;
            while (iter.hasNext()) {
                String choice = (String) iter.next();
                namesAndValues[count][0] = choice;
                namesAndValues[count][1] = choice;
                count++;
            }
            store.setDefault(arg.name(), arg.value());
            field = new ComboFieldEditor(arg.name(), arg.label(), namesAndValues, fArgumentComposite);
        } else if (arg instanceof Connector.StringArgument) {
            store.setDefault(arg.name(), arg.value());
            field = new StringFieldEditor(arg.name(), arg.label(), fArgumentComposite);
        } else if (arg instanceof Connector.BooleanArgument) {
            store.setDefault(arg.name(), ((Connector.BooleanArgument) arg).booleanValue());
            field = new BooleanFieldEditor(arg.name(), arg.label(), fArgumentComposite);
        }
        if (field != null) {
            field.setPreferenceStore(store);
            field.loadDefault();
            field.setPropertyChangeListener(this);
            fFieldEditorMap.put(key, field);
        }
    }
    fArgumentComposite.getParent().getParent().layout();
    fArgumentComposite.layout(true);
    updateLaunchConfigurationDialog();
}

From source file:net.bhl.cdt.paxelerate.ui.preferences.PAXeleratePreferencePage.java

License:Open Source License

/**
 * This method creates the editor fields for the PAXelerate file path.
 *///from ww w  . j a  v  a2s  .c  o m
/*
 * (non-Javadoc)
 * 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage
 * #createFieldEditors()
 */
@Override
public void createFieldEditors() {
    // TODO: export file name costmap, obstacle map

    StringFieldEditor project = new StringFieldEditor(PROJECT_NAME_PREFERENCE, "&Default project name:",
            getFieldEditorParent());
    addField(project);

    DirectoryFieldEditor xmiFile = new DirectoryFieldEditor(XMI_FILE_PREFERENCE, "&Cabin xmi file location:",
            getFieldEditorParent());
    addField(xmiFile);

    StringFieldEditor resultFile = new StringFieldEditor(RESULT_FILE_NAME_PREFERENCE, "&Result file name:",
            getFieldEditorParent());
    addField(resultFile);

    DirectoryFieldEditor exportPath = new DirectoryFieldEditor(EXPORT_PATH_PREFERENCE, "&Default export path:",
            getFieldEditorParent());
    addField(exportPath);
}