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:ch.elexis.omnivore.views.Preferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    // I'd like to place ALL groups in this preference dialog one under another,
    // so that each group completely occupies the available horizontal space.
    // But the default behaviour is to put the groups next to each other :-(

    // For instructions, see:
    // http://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html

    // I can't use any other layout but GridLayout.
    // Otherwise some adjustGridLayout() somewhere else will invariably throw:
    // "The currently displayed page contains invalid values." at runtime. 201304110439js
    // Besides, RowLayout() wouldn't make sense here.

    // ---//from  w w w.  ja v a  2s .  c  om

    // Nachdem ich aussenrum einmal eine globale Gruppe installiere,
    // bekomme ich wenigstens die nachfolgend tieferen Gruppen untereinander in einer Spalte,
    // und nicht mehr nebeneinander.
    // Offenbar hat die Zuweisung eines Layouts zu getFieldEditorParent() keinen Effekt gehabt.
    // Warum auch immer...

    Group gAllOmnivorePrefs = new Group(getFieldEditorParent(), SWT.NONE);

    // getFieldEditorParent().setLayoutData(SWTHelper.getFillGridData(1,false,0,false));

    GridLayout gOmnivorePrefsGridLayout = new GridLayout();
    gOmnivorePrefsGridLayout.numColumns = 1; // this is sadly and apparently ignored.
    gOmnivorePrefsGridLayout.makeColumnsEqualWidth = true;

    gAllOmnivorePrefs.setLayout(gOmnivorePrefsGridLayout);
    // getFieldEditorParent().setLayout(gOmnivorePrefsGridLayout);

    GridData gOmnivorePrefsGridLayoutData = new GridData();
    gOmnivorePrefsGridLayoutData.grabExcessHorizontalSpace = true;
    gOmnivorePrefsGridLayoutData.horizontalAlignment = GridData.FILL;

    gAllOmnivorePrefs.setLayoutData(gOmnivorePrefsGridLayoutData);
    Group gGeneralOptions = new Group(gAllOmnivorePrefs, SWT.NONE);
    GridData gGeneralOptionsGridLayoutData = new GridData();
    gGeneralOptionsGridLayoutData.grabExcessHorizontalSpace = true;
    gGeneralOptionsGridLayoutData.horizontalAlignment = GridData.FILL;
    gGeneralOptions.setLayoutData(gGeneralOptionsGridLayoutData);

    addField(new BooleanFieldEditor(DATE_MODIFIABLE, Messages.Preferences_dateModifiable, gGeneralOptions));

    Group gPathForDocs = new Group(gGeneralOptions, SWT.NONE);
    gPathForDocs.setLayout(new FillLayout());
    addField(new BooleanFieldEditor(STOREFS, Messages.Preferences_storeInFS, gPathForDocs));
    DirectoryFieldEditor dfStorePath = new DirectoryFieldEditor(BASEPATH, Messages.Preferences_pathForDocs,
            gPathForDocs);
    dfStorePath.setEmptyStringAllowed(true);
    addField(dfStorePath);
    Group gPathForMaxChars = new Group(gGeneralOptions, SWT.NONE);
    gPathForMaxChars.setLayout(new FillLayout());
    IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg);
    preferenceStore.setDefault(PREF_MAX_FILENAME_LENGTH, OmnivoreMax_Filename_Length_Default);
    IntegerFieldEditor maxCharsEditor = new IntegerFieldEditor(PREF_MAX_FILENAME_LENGTH,
            Messages.Preferences_MAX_FILENAME_LENGTH, gPathForMaxChars);
    maxCharsEditor.setValidRange(OmnivoreMax_Filename_Length_Min, OmnivoreMax_Filename_Length_Max);
    addField(maxCharsEditor);

    // ---

    // For automatic archiving of incoming files:
    // add field groups for display or editing of rule sets.
    // First, we define a new group (that will visually appear as an outlined box) and give it a
    // header like setText("Regel i");
    // Then, within this group, we add one StringFieldEditor for the search pattern to be
    // matched, and a DirectoryFieldEditor for the auto archiving target to be used.

    Integer nAutoArchiveRules = getOmnivorenRulesForAutoArchiving();

    Group gAutoArchiveRules = new Group(gAllOmnivorePrefs, SWT.NONE);
    // Group gAutoArchiveRules = new Group(getFieldEditorParent(), SWT.NONE);

    // gAutoArchiveRules.setLayoutData(SWTHelper.getFillGridData(1,true,nAutoArchiveRules,false));

    GridLayout gAutoArchiveRulesGridLayout = new GridLayout();
    gAutoArchiveRulesGridLayout.numColumns = 1; // bestimmt die Anzahl der Spalten, in denen die
    // Regeln innerhab des AutoArchiveRules containers angeordnet werden.
    gAutoArchiveRules.setLayout(gAutoArchiveRulesGridLayout);

    GridData gAutoArchiveRulesGridLayoutData = new GridData();
    gAutoArchiveRulesGridLayoutData.grabExcessHorizontalSpace = true;
    gAutoArchiveRulesGridLayoutData.horizontalAlignment = GridData.FILL;
    gAutoArchiveRules.setLayoutData(gAutoArchiveRulesGridLayoutData);

    gAutoArchiveRules.setText(Messages.Preferences_automatic_archiving_of_processed_files);

    for (int i = 0; i < nAutoArchiveRules; i++) {

        // Just to check whether the loop is actually used, even if nothing appears in the
        // preference dialog:
        log.debug(PREF_SRC_PATTERN[i] + " : " + Messages.Preferences_SRC_PATTERN);
        log.debug(PREF_DEST_DIR[i] + " : " + Messages.Preferences_DEST_DIR);

        Group gAutoArchiveRule = new Group(gAutoArchiveRules, SWT.NONE);

        GridLayout gAutoArchiveRuleGridLayout = new GridLayout();
        gAutoArchiveRuleGridLayout.numColumns = 1; // bestimmt die Anzahl der Spalten fr jede
        // Regel: links label, rechts eingabefeld (ggf. mit Knopf), but: 1, 2, 3: no change.
        gAutoArchiveRule.setLayout(gAutoArchiveRuleGridLayout);

        GridData gAutoArchiveRuleGridLayoutData = new GridData();
        gAutoArchiveRuleGridLayoutData.grabExcessHorizontalSpace = true; // damit die Gruppe der
        // Rules so breit ist, wie oben Label und Max_Filename_Length Eingabefeld zusammen.
        gAutoArchiveRuleGridLayoutData.horizontalAlignment = GridData.FILL;
        gAutoArchiveRule.setLayoutData(gAutoArchiveRuleGridLayoutData);

        // Cave: The labels show 1-based rule numbers, although the actual array indizes are 0
        // based.
        gAutoArchiveRule.setText(Messages.Preferences_Rule + " " + (i + 1)); // The brackets are
        // needed, or the string representations of i and 1 will both be added...

        addField(
                new StringFieldEditor(PREF_SRC_PATTERN[i], Messages.Preferences_SRC_PATTERN, gAutoArchiveRule));
        addField(new DirectoryFieldEditor(PREF_DEST_DIR[i], Messages.Preferences_DEST_DIR, gAutoArchiveRule));
    }
    // ---

    // Make the temporary filename configurable
    // which is generated to extract the document from the database for viewing.
    // Thereby, simplify tasks like adding a document to an e-mail.
    // For most elements noted below, we can set the maximum number of digits
    // to be used (taken from the source from left); which character to add thereafter;
    // and whether to fill leading digits by a given character.
    // This makes a large number of options, so I construct the required preference store keys
    // from arrays.

    // Originally, I would have preferred a simple tabular matrix:
    // columns: element name, fill_lead_char, num_digits, add_trail_char
    // lines: each of the configurable elements of the prospective temporary filename.
    // But such a simple thing is apparently not so simple to make using the PreferencePage
    // class.
    // So instead, I add a new group for each configurable element, including each of the 3
    // parameters.

    Integer nCotfRules = PREFERENCE_cotf_elements.length;

    Group gCotfRules = new Group(gAllOmnivorePrefs, SWT.NONE);
    // Group gCotfRules = new Group(getFieldEditorParent(), SWT.NONE);

    // gCotfRules.setLayoutData(SWTHelper.getFillGridData(6,false,nCotfRules,false)); //This
    // would probably make groups-within-group completely disappear.

    GridLayout gCotfRulesGridLayout = new GridLayout();
    gCotfRulesGridLayout.numColumns = nCotfRules; // at least this one is finally honoured...
    gCotfRules.setLayout(gCotfRulesGridLayout);

    GridData gCotfRulesGridLayoutData = new GridData();
    gCotfRulesGridLayoutData.grabExcessHorizontalSpace = true;
    gCotfRulesGridLayoutData.horizontalAlignment = GridData.FILL;
    gCotfRules.setLayoutData(gCotfRulesGridLayoutData);

    gCotfRules.setText(Messages.Preferences_construction_of_temporary_filename);

    for (int i = 0; i < nCotfRules; i++) {

        Group gCotfRule = new Group(gCotfRules, SWT.NONE);

        gCotfRule.setLayout(new FillLayout());
        GridLayout gCotfRuleGridLayout = new GridLayout();
        gCotfRuleGridLayout.numColumns = 6;
        gCotfRule.setLayout(gCotfRuleGridLayout);

        GridData gCotfRuleGridLayoutData = new GridData();
        gCotfRuleGridLayoutData.grabExcessHorizontalSpace = true;
        gCotfRuleGridLayoutData.horizontalAlignment = GridData.FILL;
        gCotfRule.setLayoutData(gCotfRuleGridLayoutData);

        gCotfRule.setText(PREFERENCE_cotf_elements_messages[i]);

        if (PREFERENCE_cotf_elements[i].contains("constant")) {
            addField(new StringFieldEditor("", "", 10, gCotfRule));
            addField(new StringFieldEditor(
                    PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_"
                            + PREFERENCE_cotf_parameters[1],
                    PREFERENCE_cotf_elements_messages[i], 10, gCotfRule));
            addField(new StringFieldEditor("", "", 10, gCotfRule));
        } else {
            addField(new StringFieldEditor(
                    PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_"
                            + PREFERENCE_cotf_parameters[0],
                    PREFERENCE_cotf_parameters_messages[0], 10, gCotfRule));
            addField(new StringFieldEditor(
                    PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_"
                            + PREFERENCE_cotf_parameters[1],
                    PREFERENCE_cotf_parameters_messages[1], 10, gCotfRule));
            addField(new StringFieldEditor(
                    PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_"
                            + PREFERENCE_cotf_parameters[2],
                    PREFERENCE_cotf_parameters_messages[2], 10, gCotfRule));
        }
    }
}

From source file:ch.elexis.preferences.Ablauf.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new RadioGroupFieldEditor(PreferenceConstants.ABL_LOGLEVEL, Messages.Ablauf_3, 2,
            new String[][] { { Messages.Ablauf_4, "1" }, //$NON-NLS-1$
                    { Messages.Ablauf_6, "2" }, //$NON-NLS-1$
                    { Messages.Ablauf_8, "3" }, //$NON-NLS-1$
                    { Messages.Ablauf_10, "4" }, //$NON-NLS-1$
                    { Messages.Ablauf_12, "5" } //$NON-NLS-1$
            }, getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(PreferenceConstants.ABL_LOGALERT, Messages.Ablauf_14, 2,
            new String[][] { { Messages.Ablauf_15, "0" }, //$NON-NLS-1$
                    { Messages.Ablauf_17, "1" }, //$NON-NLS-1$
                    { Messages.Ablauf_19, "2" }, //$NON-NLS-1$
                    { Messages.Ablauf_21, "3" } //$NON-NLS-1$
            }, getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.ABL_TRACE, Messages.Ablauf_23, getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(PreferenceConstants.ABL_LANGUAGE, Messages.Ablauf_preferredLang, 1,
            new String[][] { { Messages.Ablauf_german, "d" //$NON-NLS-1$
            }, { Messages.Ablauf_french, "f" //$NON-NLS-1$
            }, { Messages.Ablauf_italian, Messages.Ablauf_24 } }, getFieldEditorParent()));

    addField(new IntegerFieldEditor(PreferenceConstants.ABL_CACHELIFETIME, Messages.Ablauf_cachelifetime,
            getFieldEditorParent()));/*from  ww  w . j  a  v  a  2 s  .  co  m*/

    addField(new IntegerFieldEditor(PreferenceConstants.ABL_HEARTRATE, Messages.Ablauf_heartrate,
            getFieldEditorParent()));
}

From source file:ch.elexis.preferences.LabSettings.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new StringFieldEditor(KEEP_UNSEEN_LAB_RESULTS, Messages.LabSettings_showNewLabvaluesDays,
            getFieldEditorParent()));//  w  w w.  j a v a2 s .c  o  m
    addField(new RadioGroupFieldEditor(LABNEW_HEARTRATE, Messages.LabSettings_frequencyNewLabvalues, 3,
            new String[][] { { Messages.LabSettings_normal, "1" }, { Messages.LabSettings_medium, "2" }, //$NON-NLS-1$//$NON-NLS-2$
                    { Messages.LabSettings_slow, "3" } }, //$NON-NLS-1$
            getFieldEditorParent()));

}

From source file:ch.elexis.preferences.UserCasePreferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.USR_DEFCASELABEL,
            Messages.UserCasePreferences_DefaultName, getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.USR_DEFCASEREASON,
            Messages.UserCasePreferences_DefaultReason, getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.USR_DEFLAW,
            Messages.UserCasePreferences_DefaultBillingSystem, getFieldEditorParent()));
}

From source file:ch.elexis.preferences.UserTextPref.java

License:Open Source License

@Override
protected void createFieldEditors() {
    for (int i = 0; i < fields.length; i++) {
        addField(new StringFieldEditor(fields[i], texte[i], getFieldEditorParent()));
    }// w ww  .ja v  a2s .com
}

From source file:ch.elexis.privatrechnung.views.Preferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.cfgTemplateESR, "Vorlage mit ESR",
            getFieldEditorParent()));//from w w  w.  j av a2 s . c  o  m
    addField(new StringFieldEditor(PreferenceConstants.cfgTemplateBill, "Vorlage ohne ESR",
            getFieldEditorParent()));
    addField(new KontaktFieldEditor(CoreHub.globalCfg, PreferenceConstants.cfgBank, "Bank",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.esrIdentity, "ESR-Teilnehmernummer",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.esrUser, "ESR-Kundennummer", getFieldEditorParent()));
}

From source file:ch.gpb.elexis.cst.preferences.CstPreference.java

License:Open Source License

@Override
protected void createFieldEditors() {

    //Composite parent = getFieldEditorParent();

    Label lblDoc = new Label(getFieldEditorParent(), SWT.NONE);
    lblDoc.setText("Anzeigekriterien fr CST-bezogene Dokumente:");
    GridData gdDoc = new GridData();
    gdDoc.horizontalSpan = 2;//  w  w w.j av a 2  s.  co  m
    lblDoc.setLayoutData(gdDoc);

    addField(new StringFieldEditor(CST_IDENTIFIER_OMNIVORE, "Omnivore Document Kategorie",
            getFieldEditorParent()));
    addField(new StringFieldEditor(CST_IDENTIFIER_BRIEFE, "Briefe (Suchkriterium Betreff)",
            getFieldEditorParent()));

    Label lblFile = new Label(getFieldEditorParent(), SWT.NONE);
    lblFile.setText("File Export Einstellungen:");
    GridData gdFile = new GridData();
    gdFile.horizontalSpan = 2;
    gdFile.verticalIndent = 30;
    lblFile.setLayoutData(gdFile);

    addField(new StringFieldEditor(CST_IDENTIFIER_FILEPREFIX, "Prefix fr File-Namen", getFieldEditorParent()));
    addField(new StringFieldEditor(CST_IDENTIFIER_FILEFORMAT, "Datumsformat fr File-Namen (kein : verwenden!)",
            getFieldEditorParent()));
}

From source file:ch.medelexis.templator.ui.OOOProcessorPrefs.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Label info = new Label(getFieldEditorParent(), SWT.WRAP);
    info.setText(/*from w w  w.  ja va  2s  . c om*/
            "Geben Sie bitte den Startbefehl fr die Ausgabe des Dokuments ein.\nSetzen Sie % fr den Namen des auszugebenden Dokuments");
    info.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false));
    addField(new StringFieldEditor(PREFERENCE_BRANCH + "cmd", "Befehl", getFieldEditorParent()));
    addField(new StringFieldEditor(PREFERENCE_BRANCH + "param", "Parameter", getFieldEditorParent()));

}

From source file:ch.medelexis.templator.ui.Preferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new DirectoryFieldEditor(PREF_TEMPLATEBASE, "Schablonen-Verzeichnis", getFieldEditorParent()));
    Label i2 = new Label(getFieldEditorParent(), SWT.WRAP);
    i2.setText("Geben Sie bitte an, wie das Dokument nach\ndem Fertigstellen archiviert werden soll");
    i2.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false));
    addField(new BooleanFieldEditor(PREF_DOSAVE, "Dokument archivieren", getFieldEditorParent()));
    addField(new StringFieldEditor(PREF_CATEGORY, "Docmanager-Kategorie", getFieldEditorParent()));

}

From source file:ch.ntb.inf.deep.eclipse.ui.preferences.DeepPreferencePage.java

License:Apache 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   w  w w .  j  av  a  2  s  . c  o m
 */
public void createFieldEditors() {
    addField(new DirectoryFieldEditor(PreferenceConstants.DEFAULT_LIBRARY_PATH, "&Default library path:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.DEFAULT_BOARD, "&Default board:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.DEFAULT_OS, "&Default operating system:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.DEFAULT_PROGRAMMER, "&Default programmer:",
            getFieldEditorParent()));
}