List of usage examples for java.util.prefs Preferences remove
public abstract void remove(String key);
From source file:org.nuclos.client.main.MainController.java
/** * - cleanup old preferences./* ww w . j a va2s.c o m*/ * - not in use any more. */ private void removeUnusedPreferences() { getExplorerController().prefs.remove(ExplorerController.PREFS_NODE_EXPLORERVIEWS_XML); getExplorerController().prefs.remove(ExplorerController.PREFS_NODE_EXPLORERVIEWS); getExplorerController().prefs.remove(ExplorerController.PREFS_NODE_EXPLORER_EXPANDEDPATHS); Preferences settingsPrefs = ClientPreferences.getUserPreferences().node("explorer").node("settings"); settingsPrefs.remove("showExplorerMode"); settingsPrefs.remove("showTaskpanelMode"); settingsPrefs.remove("transparencyLevel"); try { ClientPreferences.getUserPreferences().node(PREFS_NODE_MDIWINDOWS).removeNode(); } catch (BackingStoreException e) { LOG.error("removeUnusedPreferences failed: " + e, e); } }
From source file:org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinitionManager.java
private static void put(final Preferences node, final String key, final String value) { if (value == null) { node.remove(key); } else {/* w w w. j a va 2 s . co m*/ node.put(key, value); } }
From source file:org.rhq.server.control.command.AbstractInstall.java
private void clearAgentPreferences() throws Exception { log.info("Removing any existing agent preferences from default preference node"); // remove everything EXCEPT the security token Preferences agentPrefs = getAgentPreferences(); String[] prefKeys = null;//from w w w . j a v a2 s . com try { prefKeys = agentPrefs.keys(); } catch (Exception e) { log.warn("Failed to get agent preferences - cannot clear them: " + e); } if (prefKeys != null && prefKeys.length > 0) { for (String prefKey : prefKeys) { if (!prefKey.equals(PREF_RHQ_AGENT_SECURITY_TOKEN)) { agentPrefs.remove(prefKey); } } agentPrefs.flush(); Preferences.userRoot().sync(); } }