public void savePrefs() { // prefs.putBoolean(PREF_VAR_INTERPRET, isVarInterpretationEnabled()); // prefs.putBoolean(PREF_OVERRIDE, isOverrideEnabled()); // prefs.putBoolean(PREF_VERIF, isAutoBuildEnabled()); // prefs.putBoolean(PREF_STRICT, isStrictModeEnabled()); prefs.putBoolean(PREF_INDENT_SPACES, isIndentSpacesEnabled()); prefs.putBoolean(PREF_FULL_AUTOCOMPLETE, isFullAutoCompleteEnabled()); prefs.putBoolean(PREF_AUTOCLEAR_OUTPUT, isAutoClearOutputEnabled()); prefs.putInt(PREF_INDENT_SPACES_VALUE, indentSpacesCount()); }
public void loadPrefs() { // cboxVarInterp.setSelected(prefs.getBoolean(PREF_VAR_INTERPRET, Boolean.TRUE)); // cboxOverride.setSelected(prefs.getBoolean(PREF_OVERRIDE, Boolean.TRUE)); // cboxAutoVerif.setSelected(prefs.getBoolean(PREF_VERIF, Boolean.TRUE)); // cboxStrict.setSelected(prefs.getBoolean(PREF_STRICT, Boolean.FALSE)); cboxFullAutocomplete.setSelected(prefs.getBoolean(PREF_FULL_AUTOCOMPLETE, Boolean.TRUE)); cboxAutoClearOutput.setSelected(prefs.getBoolean(PREF_AUTOCLEAR_OUTPUT, true)); boolean active = prefs.getBoolean(PREF_INDENT_SPACES, Boolean.FALSE); cboxSoft.setSelected(active); tfSpacesTab.setEnabled(active); tfSpacesTab.setValue("" + prefs.getInt(PREF_INDENT_SPACES_VALUE, 8)); }
@Override protected ArrayList<String> loadEntry(String key) { if (preferences.nodeExists(key)) { final ArrayList<String> result = new ArrayList<String>(); final XMLPreferences pref = preferences.node(key); // load size final int numFile = pref.getInt(ID_NB_FILE, 0); // load filenames for (int i = 0; i < numFile; i++) result.add(pref.get(ID_FILE + i, "")); return result; } return null; }
@SuppressWarnings("unchecked") @Override protected void saveEntry(String key, Object value) { final XMLPreferences pref = preferences.node(key); // remove all children pref.removeChildren(); // then save if (value != null) { final ArrayList<String> filenames = (ArrayList<String>) value; final int numFile = filenames.size(); // save size pref.putInt(ID_NB_FILE, numFile); // save filenames for (int i = 0; i < numFile; i++) pref.put(ID_FILE + i, filenames.get(i)); } else { // save size pref.putInt(ID_NB_FILE, 0); } // then clean pref.clean(); }