List of usage examples for org.eclipse.jface.preference IPreferenceStore setDefault
void setDefault(String name, boolean value);
From source file:carisma.ui.eclipse.CarismaGUI.java
License:Open Source License
@Override protected final void initializeDefaultPreferences(final IPreferenceStore store) { store.setDefault(Constants.EDITOR_ID, Constants.TEXT_EDITOR_ID); store.setDefault(Constants.PERSPECTIVE_ID, Perspective.ID); store.setDefault(Constants.PREF_ANALYSE, false); store.setDefault(Constants.EDITOR_SELECTION_ART, Constants.MANUALLY); }
From source file:carisma.ui.eclipse.CarismaGUI.java
License:Open Source License
@Override protected final void initializeDefaultPluginPreferences() { IPreferenceStore store = this.getPreferenceStore(); store.setDefault(Constants.EDITOR_ID, Constants.TEXT_EDITOR_ID); store.setDefault(Constants.PERSPECTIVE_ID, Perspective.ID); store.setDefault(Constants.PREF_ANALYSE, false); store.setDefault(Constants.EDITOR_SELECTION_ART, Constants.MANUALLY); }
From source file:ccw.preferences.OverlayPreferenceStore.java
License:Open Source License
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) { TypeDescriptor d = key.fDescriptor;/*w ww. j a v a 2 s . co m*/ if (BOOLEAN == d) { if (forceInitialization) target.setValue(key.fKey, true); target.setValue(key.fKey, orgin.getBoolean(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey)); } else if (DOUBLE == d) { if (forceInitialization) target.setValue(key.fKey, 1.0D); target.setValue(key.fKey, orgin.getDouble(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey)); } else if (FLOAT == d) { if (forceInitialization) target.setValue(key.fKey, 1.0F); target.setValue(key.fKey, orgin.getFloat(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey)); } else if (INT == d) { if (forceInitialization) target.setValue(key.fKey, 1); target.setValue(key.fKey, orgin.getInt(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey)); } else if (LONG == d) { if (forceInitialization) target.setValue(key.fKey, 1L); target.setValue(key.fKey, orgin.getLong(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey)); } else if (STRING == d) { if (forceInitialization) target.setValue(key.fKey, "1"); //$NON-NLS-1$ target.setValue(key.fKey, orgin.getString(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultString(key.fKey)); } }
From source file:ccw.preferences.PreferenceInitializer.java
License:Open Source License
@Override public void initializeDefaultPreferences() { IPreferenceStore store = CCWPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.CCW_GENERAL_AUTOMATIC_NATURE_ADDITION, true); store.setDefault(PreferenceConstants.CCW_GENERAL_AUTO_RELOAD_ON_STARTUP_SAVE, false); store.setDefault(PreferenceConstants.CCW_GENERAL_LAUNCH_REPLS_IN_DEBUG_MODE, true); store.setDefault(PreferenceConstants.CCW_GENERAL_USE_LEININGEN_LAUNCHER, true); store.setDefault(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_MATCHING_BRACKETS, true); store.setDefault(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, StringConverter.asString(new RGB(150, 150, 150))); store.setDefault(PreferenceConstants.EDITOR_ESCAPE_ON_PASTE, false); store.setDefault(PreferenceConstants.EDITOR_CODE_COMPLETION_AUTO_ACTIVATE, true); store.setDefault(PreferenceConstants.EDITOR_DISPLAY_NAMESPACE_IN_TABS, true); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 2); store.setDefault(PreferenceConstants.SWITCH_TO_NS_ON_REPL_STARTUP, true); store.setDefault(USE_STRICT_STRUCTURAL_EDITING_MODE_BY_DEFAULT, false); store.setDefault(PreferenceConstants.SHOW_RAINBOW_PARENS_BY_DEFAULT, true); store.setDefault(PreferenceConstants.USE_TAB_FOR_REINDENTING_LINE, true); store.setDefault(PreferenceConstants.FORCE_TWO_SPACES_INDENT, false); store.setDefault(PreferenceConstants.REPL_VIEW_AUTO_EVAL_ON_ENTER_ACTIVE, true); store.setDefault(PreferenceConstants.REPL_VIEW_DISPLAY_HINTS, true); store.setDefault(PreferenceConstants.REPL_HISTORY_MAX_SIZE, 1000); store.setDefault(PreferenceConstants.REPL_HISTORY_PERSIST_SCHEDULE, 30000); for (SyntaxColoringDefault d : coloringDefaults) { store.setDefault(d.getPreferenceConstant(), StringConverter.asString(d.getDefaultColor())); store.setDefault(SyntaxColoringHelper.getEnabledPreferenceKey(d.getPreferenceConstant()), d.isDefaultEnabled());//from w w w . java2s . c om store.setDefault(SyntaxColoringHelper.getBoldPreferenceKey(d.getPreferenceConstant()), d.isBold()); store.setDefault(SyntaxColoringHelper.getItalicPreferenceKey(d.getPreferenceConstant()), d.isItalic()); } // Experimental Features store.setDefault(PreferenceConstants.EXPERIMENTAL_AUTOSHIFT_ENABLED, true); }
From source file:ch.elexis.core.ui.preferences.PreferenceInitializer.java
License:Open Source License
/** * Diese Funktion wird nach erstem Erstellen der Datenbank (d.h. nur ein einziges Mal) * aufgerufen und belegt globale Voreinstellungen. Hier alle im ganzen Netzwerk und fr alle * Benutzer gltigen Voreinstellungen eintragen * //from w w w . j a va2 s . c o m */ public void initializeGlobalPreferences() { IPreferenceStore global = new SettingsPreferenceStore(CoreHub.globalCfg); global.setDefault(Preferences.ABL_TRACE, "none"); //$NON-NLS-1$ CoreHub.globalCfg.flush(); }
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. // ---/*w ww. ja v a 2 s .co 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. // ---/*from w ww . j ava 2 s.com*/ // 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.PreferenceInitializer.java
License:Open Source License
/** * Diese Funktion wird automatisch beim Programmstart aufgerufen, und setzt alle hier * definierten Einstellungswerte auf Voreinstellungen, sofern noch keine vom Anwender erstellten * Werte vorhanden sind. Hier alle Benutzerspezifischen Voreinstellungen eintragen *//* w w w . jav a2s .c o m*/ public void initializeDefaultPreferences() { IPreferenceStore localstore = new SettingsPreferenceStore(Hub.localCfg); // Datenbank /* * localstore.setDefault(PreferenceConstants.DB_NAME,"hsql"); //$NON-NLS-1$ * localstore.setDefault(PreferenceConstants.DB_CLASS,"org.hsqldb.jdbcDriver"); * //$NON-NLS-1$ String base=getDefaultDBPath(); * * localstore.setDefault(PreferenceConstants.DB_CONNECT,"jdbc:hsqldb:"+base+"/db"); * //$NON-NLS-1$ //$NON-NLS-2$ localstore.setDefault(PreferenceConstants.DB_USERNAME,"sa"); * //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.DB_PWD,""); //$NON-NLS-1$ * localstore.setDefault(PreferenceConstants.DB_TYP,"hsqldb"); //$NON-NLS-1$ */ localstore.setDefault(PreferenceConstants.DB_NAME, "h2"); //$NON-NLS-1$ //localstore.setDefault(PreferenceConstants.DB_CLASS,"org.h2.Driver"); //$NON-NLS-1$ String base = getDefaultDBPath(); localstore.setDefault(PreferenceConstants.DB_CONNECT, "jdbc:h2:" + base + "/db;MODE=MySQL"); //$NON-NLS-1$ //$NON-NLS-2$ localstore.setDefault(PreferenceConstants.DB_USERNAME, "sa"); //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.DB_PWD, ""); //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.DB_TYP, "mysql"); //$NON-NLS-1$ // Ablauf File userhome = new File(System.getProperty("user.home") + File.separator + "elexis"); //$NON-NLS-1$ //$NON-NLS-2$ if (!userhome.exists()) { userhome.mkdirs(); } localstore.setDefault(PreferenceConstants.ABL_LOGALERT, 1); localstore.setDefault(PreferenceConstants.ABL_LOGLEVEL, 2); localstore.setDefault(PreferenceConstants.ABL_TRACE, "none"); //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.ABL_BASEPATH, userhome.getAbsolutePath()); localstore.setDefault(PreferenceConstants.ABL_CACHELIFETIME, PersistentObject.CACHE_DEFAULT_LIFETIME); localstore.setDefault(PreferenceConstants.ABL_HEARTRATE, 30); Hub.localCfg.set(PreferenceConstants.ABL_BASEPATH, userhome.getAbsolutePath()); // Texterstellung if (System.getProperty("os.name").toLowerCase().startsWith("win")) { //$NON-NLS-1$ //$NON-NLS-2$ localstore.setDefault(PreferenceConstants.P_TEXTMODUL, "NOA-Text"); //$NON-NLS-1$ if (localstore.getString(PreferenceConstants.P_TEXTMODUL).equals(StringTool.leer)) { localstore.setValue(PreferenceConstants.P_TEXTMODUL, "NOA-Text"); //$NON-NLS-1$ } } else { localstore.setDefault(PreferenceConstants.P_TEXTMODUL, "OpenOffice Wrapper"); //$NON-NLS-1$ if (localstore.getString(PreferenceConstants.P_TEXTMODUL).equals("")) { //$NON-NLS-1$ localstore.setValue(PreferenceConstants.P_TEXTMODUL, "OpenOffice Wrapper"); //$NON-NLS-1$ } } File elexisbase = new File(Hub.getBasePath()); File fDef = new File(elexisbase.getParentFile().getParent() + "/ooo"); //$NON-NLS-1$ String defaultbase; if (fDef.exists()) { defaultbase = fDef.getAbsolutePath(); } else { defaultbase = Hub.localCfg.get(PreferenceConstants.P_OOBASEDIR, "."); //$NON-NLS-1$ } System.setProperty("openoffice.path.name", defaultbase); //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.P_OOBASEDIR, defaultbase); localstore.setValue(PreferenceConstants.P_OOBASEDIR, defaultbase); // Dokument StringBuilder sb = new StringBuilder(); sb.append("Alle,").append(Brief.UNKNOWN).append(",").append(Brief.AUZ).append(",") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ .append(Brief.RP).append(",").append(Brief.LABOR); //$NON-NLS-1$ localstore.setDefault(PreferenceConstants.DOC_CATEGORY, sb.toString()); Hub.localCfg.flush(); }
From source file:ch.elexis.preferences.PreferenceInitializer.java
License:Open Source License
/** * Diese Funktion wird nach erstem Erstellen der Datenbank (d.h. nur ein einziges Mal) * aufgerufen und belegt globale Voreinstellungen. Hier alle im ganzen Netzwerk und fr alle * Benutzer gltigen Voreinstellungen eintragen * //from ww w .jav a2s . co m */ public void initializeGlobalPreferences() { IPreferenceStore global = new SettingsPreferenceStore(Hub.globalCfg); global.setDefault(PreferenceConstants.ABL_TRACE, "none"); //$NON-NLS-1$ Hub.globalCfg.flush(); }
From source file:ch.hsr.ifs.cutelauncher.ui.PreferenceInitializer.java
License:Open Source License
@Override public void initializeDefaultPreferences() { IPreferenceStore store = CuteLauncherPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.SHOW_WHITESPACES, false); }