List of usage examples for org.eclipse.jface.preference IntegerFieldEditor setValidRange
public void setValidRange(int min, int max)
From source file:br.ufmg.dcc.tabuleta.ui.ConcernMapperPreferencePage.java
License:Open Source License
/** * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() *//*from www .ja va 2 s . c om*/ public void createFieldEditors() { //ConcernMapperFilter addField(new LabelFieldEditor(Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.HeaderFilter"), getFieldEditorParent())); addField(new BooleanFieldEditor(P_FILTER_ENABLED, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.FilterEnabled"), getFieldEditorParent())); IntegerFieldEditor lIntegerFieldEditor = new IntegerFieldEditor(P_FILTER_THRESHOLD, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.FilterThreshold"), getFieldEditorParent()); lIntegerFieldEditor.setValidRange(0, MAX_FILTER_THRESHOLD); addField(lIntegerFieldEditor); addField(new LabelFieldEditor("", getFieldEditorParent())); //Saving addField(new LabelFieldEditor(Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.HeaderSaving"), getFieldEditorParent())); addField(new BooleanFieldEditor(P_CM_FILE_EXT, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.CmFileExt"), getFieldEditorParent())); addField(new BooleanFieldEditor(P_AUTO_SAVE, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.AutoSave"), getFieldEditorParent())); addField(new BooleanFieldEditor(P_AUTO_LOAD, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.AutoLoad"), getFieldEditorParent())); addField(new LabelFieldEditor("", getFieldEditorParent())); //UI addField(new LabelFieldEditor(Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.HeaderUI"), getFieldEditorParent())); addField(new BooleanFieldEditor(ConcernMapperPreferencePage.P_SHOW_SLIDER, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.ShowSlider"), getFieldEditorParent())); addField(new BooleanFieldEditor(ConcernMapperPreferencePage.P_SHOW_COMMENTS, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.ShowComments"), getFieldEditorParent())); addField(new BooleanFieldEditor(ConcernMapperPreferencePage.P_SUFFIX_ENABLED, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.SuffixEnabled"), getFieldEditorParent())); addField(new BooleanFieldEditor(ConcernMapperPreferencePage.P_BOLD_ENABLED, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.BoldEnabled"), getFieldEditorParent())); String[][] lRadioGroupValues = { { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent1"), "1" }, { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent2"), "2" }, { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent3"), "3" }, { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent4"), "4" }, { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent5"), "5" }, { Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.Parent6"), "7" } }; addField(new RadioGroupFieldEditor(ConcernMapperPreferencePage.P_DECORATION_LIMIT, Tabuleta.getResourceString("ui.ConcernMapperPreferencePage.ParentDecoration"), 1, lRadioGroupValues, getFieldEditorParent())); }
From source file:ch.elexis.omnivore.ui.preferences.PreferencePage.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. // ---// www . j a va 2s .c o m // 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()); bStoreFSGlobal = new BooleanFieldEditor(STOREFSGLOBAL, "Dateisystem Einstellungen global speichern", gPathForDocs) { @Override protected void fireValueChanged(String property, Object oldValue, Object newValue) { super.fireValueChanged(property, oldValue, newValue); if ((Boolean) newValue) { Preferences.setFsSettingStore(new SettingsPreferenceStore(CoreHub.globalCfg)); updateFSSettingsStore(); } else { Preferences.setFsSettingStore(new SettingsPreferenceStore(CoreHub.localCfg)); updateFSSettingsStore(); } } }; addField(bStoreFSGlobal); bStoreFS = new BooleanFieldEditor(STOREFS, Messages.Preferences_storeInFS, gPathForDocs); addField(bStoreFS); Preferences.storeInFilesystem(); dfStorePath = new DirectoryFieldEditor(BASEPATH, Messages.Preferences_pathForDocs, gPathForDocs); Preferences.getBasepath(); dfStorePath.setEmptyStringAllowed(true); addField(dfStorePath); Label label = new Label(gAllOmnivorePrefs, SWT.NONE); label.setText("Datenbankeintrge auf Filesystem auslagern"); outsource = new Button(gAllOmnivorePrefs, SWT.PUSH); outsource.setText("Auslagern"); outsource.setEnabled(false); outsource.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { OutsourceUiJob job = new OutsourceUiJob(); job.execute(getShell()); } }); 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 = Preferences.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)); } } enableOutsourceButton(); }
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. // ---/*ww w . j av a2s .c o m*/ // 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.unibe.iam.scg.archie.preferences.ArchiePreferencePage.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 w w . java2 s . co m @Override public void createFieldEditors() { Composite parent = this.getFieldEditorParent(); IntegerFieldEditor cohortSizeEditor = new IntegerFieldEditor(PreferenceConstants.P_COHORT_SIZE, "Cohort size in Dashboard charts: ", parent); cohortSizeEditor.setValidRange(1, 99); cohortSizeEditor.setErrorMessage("You must set a cohort size value greater then 0 but smaller then 99."); this.addField(cohortSizeEditor); }
From source file:com.android.ide.eclipse.ddms.preferences.PreferencePage.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. *///w w w . j a v a 2 s .c o m @Override public void createFieldEditors() { IntegerFieldEditor ife; ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_DEBUG_PORT_BASE, Messages.PreferencePage_Base_Local_Debugger_Port, getFieldEditorParent()); ife.setValidRange(1024, 32767); addField(ife); BooleanFieldEditor bfe; bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_THREAD_UPDATE, Messages.PreferencePage_Thread_Updates_Enabled_By_Default, getFieldEditorParent()); addField(bfe); bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_HEAP_UPDATE, Messages.PreferencePage_Heap_Updates_Enabled_Default, getFieldEditorParent()); addField(bfe); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_THREAD_INTERVAL, Messages.PreferencePage_Thread_Status_Refresh_Interval, getFieldEditorParent()); ife.setValidRange(1, 60); addField(ife); if (InstallDetails.isAdtInstalled()) { ComboFieldEditor cfe = new ComboFieldEditor(PreferenceInitializer.ATTR_HPROF_ACTION, Messages.PreferencePage_HPROF_Action, new String[][] { { Messages.PreferencePage_Save_Disk, HProfHandler.ACTION_SAVE }, { Messages.PreferencePage_Open_Eclipse, HProfHandler.ACTION_OPEN }, }, getFieldEditorParent()); addField(cfe); } mProfilerBufsize = new IntegerFieldEditor(PreferenceInitializer.ATTR_PROFILER_BUFSIZE_MB, "Method Profiler buffer size (MB):", getFieldEditorParent()); addField(mProfilerBufsize); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_TIME_OUT, Messages.PreferencePage_ADB_Connection_Time_Out, getFieldEditorParent()); addField(ife); RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor(PreferenceInitializer.ATTR_LOG_LEVEL, Messages.PreferencePage_Logging_Level, 1, new String[][] { { Messages.PreferencePage_Verbose, LogLevel.VERBOSE.getStringValue() }, { Messages.PreferencePage_Debug, LogLevel.DEBUG.getStringValue() }, { Messages.PreferencePage_Info, LogLevel.INFO.getStringValue() }, { Messages.PreferencePage_Warning, LogLevel.WARN.getStringValue() }, { Messages.PreferencePage_Error, LogLevel.ERROR.getStringValue() }, { Messages.PreferencePage_Assert, LogLevel.ASSERT.getStringValue() } }, getFieldEditorParent(), true); addField(rgfe); mUseAdbHost = new BooleanFieldEditor(PreferenceInitializer.ATTR_USE_ADBHOST, Messages.PreferencePage_Use_Adbhost, getFieldEditorParent()); addField(mUseAdbHost); mAdbHostValue = new StringFieldEditor(PreferenceInitializer.ATTR_ADBHOST_VALUE, Messages.PreferencePage_Adbhost_value, getFieldEditorParent()); mAdbHostValue.setEnabled(getPreferenceStore().getBoolean(PreferenceInitializer.ATTR_USE_ADBHOST), getFieldEditorParent()); addField(mAdbHostValue); }
From source file:com.aptana.editor.common.preferences.EditorsPreferencePage.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 w w w .ja v a 2 s .c o m public void createFieldEditors() { Composite appearanceComposite = getFieldEditorParent(); // Typing Composite group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_Typing); addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_CHARACTER_PAIR_COLORING, Messages.EditorsPreferencePage_Colorize_Matching_Character_Pairs, group)); addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_PEER_CHARACTER_CLOSE, Messages.EditorsPreferencePage_Close_Matching_Character_Pairs, group)); addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_WRAP_SELECTION, Messages.EditorsPreferencePage_Wrap_Selection, group)); // Save Actions group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_saveActionsGroup); addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_REMOVE_TRAILING_WHITESPACE, Messages.EditorsPreferencePage_saveActionRemoveWhitespaceCharacters, group)); // Syntax coloring group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_SyntaxColoring); group.setLayout(GridLayoutFactory.swtDefaults().create()); group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); IntegerFieldEditor colEditor = new IntegerFieldEditor(IPreferenceConstants.EDITOR_MAX_COLORED_COLUMNS, StringUtil.makeFormLabel(Messages.EditorsPreferencePage_MaxColumnsLabel), group); colEditor.setValidRange(-1, Integer.MAX_VALUE); addField(colEditor); // Word Wrap addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_WORD_WRAP, Messages.EditorsPreferencePage_Enable_WordWrap, appearanceComposite)); createTextEditorLink(appearanceComposite); }
From source file:com.clustercontrol.approval.preference.ApprovalPreferencePage.java
License:Open Source License
/** * ????/*from w w w . j a v a 2s . co m*/ * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor) */ @Override public void createFieldEditors() { m_log.trace("ApprovalPreferencePage.createFieldEditors()"); Composite parent = this.getFieldEditorParent(); GridData gridData = null; // ? Group group = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, null, group); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; group.setLayoutData(gridData); group.setText(Messages.getString("view.approval.list")); // this.addField( new BooleanFieldEditor(P_APPROVAL_MESSAGE_FLG, Messages.getString("over.limit.message"), group)); // String[] args = { Integer.toString(1), Integer.toString(DataRangeConstant.SMALLINT_HIGH) }; IntegerFieldEditor histories = new IntegerFieldEditor(P_APPROVAL_MAX_LIST, Messages.getString("number.of.display.list") + " : ", group); histories.setValidRange(1, DataRangeConstant.SMALLINT_HIGH); histories.setErrorMessage(Messages.getString("message.hinemos.8", args)); this.addField(histories); }
From source file:com.clustercontrol.collect.preference.PerformancePreferencePage.java
License:Open Source License
/** * ??//from w w w . j a v a 2 s.c om */ @Override protected void createFieldEditors() { log.debug("createFieldEditors()"); Composite parent = this.getFieldEditorParent(); GridData gridData = null; // [] Group perfGroup = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, null, perfGroup); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; perfGroup.setLayoutData(gridData); perfGroup.setText(Messages.getString("view.performance.graph.default")); // ? IntegerFieldEditor graphMax = new IntegerFieldEditor(P_GRAPH_MAX, MSG_GRAPH_MAX, perfGroup); graphMax.setValidRange(COLLECT_GRAPH_DATA_MIN_SIZE, COLLECT_GRAPH_DATA_MAX_SIZE); String[] args1 = { Integer.toString(COLLECT_GRAPH_DATA_MIN_SIZE), Integer.toString(COLLECT_GRAPH_DATA_MAX_SIZE) }; graphMax.setErrorMessage(Messages.getString("message.hinemos.8", args1)); this.addField(graphMax); // ? IntegerFieldEditor downloadMaxWait = new IntegerFieldEditor(P_DL_MAX_WAIT, MSG_DL_MAX_WAIT, perfGroup); downloadMaxWait.setValidRange(COLLECT_GRAPH_DOWNLOAD_MIN_WAIT_MINUTE, COLLECT_GRAPH_DOWNLOAD_MAX_WAIT_MINUTE); String[] args2 = { Integer.toString(COLLECT_GRAPH_DOWNLOAD_MIN_WAIT_MINUTE), Integer.toString(COLLECT_GRAPH_DOWNLOAD_MAX_WAIT_MINUTE) }; downloadMaxWait.setErrorMessage(Messages.getString("message.hinemos.8", args2)); this.addField(downloadMaxWait); }
From source file:com.clustercontrol.hub.preference.HubPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Composite parent = this.getFieldEditorParent(); GridData gridData = null;/*from ww w. j a v a2s . c o m*/ // ? Group resultGroup = new Group(parent, SWT.SHADOW_NONE); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; resultGroup.setLayoutData(gridData); resultGroup.setText(Messages.getString("view.hub.preference.search")); // ? 1 IntegerFieldEditor pageMax = new IntegerFieldEditor(P_SIZE_POS, MSG_SIZE_POS, resultGroup); pageMax.setValidRange(1, DataRangeConstant.SMALLINT_HIGH); String[] args1 = { Integer.toString(1), Integer.toString(DataRangeConstant.SMALLINT_HIGH) }; pageMax.setErrorMessage(Messages.getString("message.hinemos.8", args1)); this.addField(pageMax); }
From source file:com.clustercontrol.jobmanagement.preference.JobManagementPreferencePage.java
License:Open Source License
/** * ????/*w ww . j a v a 2 s . c om*/ * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor) */ @Override public void createFieldEditors() { Composite parent = this.getFieldEditorParent(); GridData gridData = null; // [] Group group = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, null, group); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; group.setLayoutData(gridData); group.setText(Messages.getString("view.job.history")); // this.addField(new BooleanFieldEditor(P_HISTORY_UPDATE_FLG, Messages.getString("autoupdate.enable"), group)); // IntegerFieldEditor cycle = new IntegerFieldEditor(P_HISTORY_UPDATE_CYCLE, Messages.getString("autoupdate.cycle") + " : ", group); cycle.setValidRange(1, DataRangeConstant.SMALLINT_HIGH); String[] args = { Integer.toString(1), Integer.toString(DataRangeConstant.SMALLINT_HIGH) }; cycle.setErrorMessage(Messages.getString("message.hinemos.8", args)); this.addField(cycle); // this.addField( new BooleanFieldEditor(P_HISTORY_MESSAGE_FLG, Messages.getString("over.limit.message"), group)); // IntegerFieldEditor histories = new IntegerFieldEditor(P_HISTORY_MAX_HISTORIES, Messages.getString("number.of.display.histories") + " : ", group); histories.setValidRange(1, DataRangeConstant.SMALLINT_HIGH); histories.setErrorMessage(Messages.getString("message.hinemos.8", args)); this.addField(histories); // [] Group planGroup = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, "plan", planGroup); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; planGroup.setLayoutData(gridData); planGroup.setText(Messages.getString("view.job.plan")); String[] argsPlan = { Integer.toString(1), Integer.toString(DataRangeConstant.SMALLINT_HIGH) }; // IntegerFieldEditor plan = new IntegerFieldEditor(P_PLAN_MAX_SCHEDULE, Messages.getString("number.of.display.list") + " : ", planGroup);// FIXME ???? plan.setValidRange(1, DataRangeConstant.SMALLINT_HIGH); plan.setErrorMessage(Messages.getString("message.hinemos.8", argsPlan)); this.addField(plan); }