HistoricalData(Preferences prefs) { this.prefs = prefs; try { historical.addAll(reload()); } catch (BackingStoreException e) { e.printStackTrace(); } Collections.sort(historical, getIdComparator()); }
/** * Tests preference based AppSettings. */ private static void testPreferenceSettings() { AppSettings settings = new AppSettings(false); settings.putBoolean("TestBool", true); settings.putInteger("TestInt", 123); settings.putString("TestStr", "HelloWorld"); settings.putFloat("TestFloat", 123.567f); settings.put("TestObj", new Mesh()); // Objects not supported by preferences try { settings.save(APPSETTINGS_KEY); } catch (BackingStoreException ex) { ex.printStackTrace(); } AppSettings loadedSettings = new AppSettings(false); try { loadedSettings.load(APPSETTINGS_KEY); } catch (BackingStoreException ex) { ex.printStackTrace(); } assertEqual(loadedSettings.getBoolean("TestBool"), true); assertEqual(loadedSettings.getInteger("TestInt"), 123); assertEqual(loadedSettings.getString("TestStr"), "HelloWorld"); assertEqual(loadedSettings.get("TestFloat"), 123.567f); }
public Config(String filename) { iniFile = new File(filename); System.out.println("opening config from " + filename); try { loadConfig(iniFile); } catch (BackingStoreException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public String getPref(String section, String key) { try { if (prefs.nodeExists(section)) return prefs.node(section).get(key, null); } catch (BackingStoreException e) { e.printStackTrace(); } return null; }
public static Set<String> ignoreList(String serverAddress) { try { return Sets.newHashSet(ignoreListNode(serverAddress).keys()); } catch (BackingStoreException e) { e.printStackTrace(); } return Sets.newHashSet(); }
public static void saveValue(String key, String value) { Preferences prefs = MageFrame.getPreferences(); prefs.put(key, value); try { prefs.flush(); } catch (BackingStoreException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, "Error: couldn't save preferences. Please try once again."); } updateCache(key, value); }
private void flushPrefs() { try { prefs.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } }
@Override public void run() { try { systemRoot.flush(); } catch (final BackingStoreException ex) { System.err.println("Failed to save 'systemRoot' preferences!"); ex.printStackTrace(System.err); } } });
public synchronized void closePrefs() { if (_preference != null) { try { _preference.sync(); } catch (BackingStoreException e) { e.printStackTrace(); } } _preference = null; }
public static final void putSaveAlignmentDirectory(String dirName){ prefs.put(SAVE_ALIGNMENT_DIRECTORY, dirName); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void run() { try { userRoot.flush(); } catch (final BackingStoreException ex) { System.err.println("Failed to save 'userRoot' preferences!"); ex.printStackTrace(System.err); } } });
public void flush() { try { prefs.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } }
HistoricalData(Preferences prefs) { this.prefs = prefs; try { historical.addAll(reload()); } catch (BackingStoreException e) { e.printStackTrace(); } Collections.sort(historical, getIdComparator()); }
public static void putBooleanValue(SettingValue settingValue,boolean booleanValue) { prefs.putBoolean(settingValue.getPrefsKey(), booleanValue); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public static void putStringValue(SettingValue settingValue, String value) { prefs.put(settingValue.getPrefsKey(), value); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Deprecated public static void resetPreferences() { try { Preferences.userNodeForPackage(ChannelFinderClientImpl.class) .clear(); } catch (BackingStoreException e) { e.printStackTrace(); } }
public static void setColorSchemeAminoAcid(ColorScheme colorScheme) { prefs.put(COLOR_SCHEME_AMINOACID, colorScheme.getName()); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public static void putIntValue(SettingValue settingValue){ logger.info("put" + settingValue.getIntValue()); prefs.putInt(settingValue.getPrefsKey(), settingValue.getIntValue()); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void reset(boolean setDefaultOptions) { try { getPref().clear(); } catch (BackingStoreException e) { e.printStackTrace(); } if (setDefaultOptions) { resetDefaultValues(); } }
private static void clearCommandItem(int i, String prefix){ prefs.remove(prefix + CMD_NAME_ + i); prefs.remove(prefix + CMD_PROGRAM_PATH_ + i); prefs.remove(prefix + CMD_COMMAND_ + i); prefs.remove(prefix + CMD_IS_ACTIVATED_ + i); prefs.remove(prefix + CMD_SHOW_COMMAND_WIN_ + i); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }