List of usage examples for java.util.prefs Preferences flush
public abstract void flush() throws BackingStoreException;
From source file:org.pdfsam.ui.StatefullPreferencesStageService.java
void clearStageStatus() { Preferences prefs = Preferences.userRoot().node(STAGE_PATH); try {//www .j a va 2 s .c o m prefs.removeNode(); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to clear stage status", e); } }
From source file:org.pdfsam.module.PreferencesUsageDataStore.java
public void clear() { Preferences prefs = Preferences.userRoot().node(USAGE_PATH); try {/*from ww w.j a va2 s . c o m*/ prefs.removeNode(); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to clear modules usage statistics", e); } }
From source file:org.pdfsam.ui.StatefullPreferencesStageService.java
@PreDestroy void flush() {//from w w w . java2 s . c o m Preferences prefs = Preferences.userRoot().node(STAGE_PATH); try { LOG.trace("Flushing stage information"); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to stage status information", e); } }
From source file:org.pdfsam.module.PreferencesUsageDataStore.java
@PreDestroy public void flush() { Preferences prefs = Preferences.userRoot().node(USAGE_PATH); try {//ww w.j a v a 2 s . co m LOG.trace("Flushing modules usage"); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to flush modules usage statistics", e); } }
From source file:org.pdfsam.ui.PreferencesRecentWorkspacesServiceTest.java
@Test public void blankIsNotLoaded() throws BackingStoreException { Preferences node = Preferences.userRoot().node(WORKSPACES_PATH); node.put("1", EMPTY); node.flush(); PreferencesRecentWorkspacesService newVictim = new PreferencesRecentWorkspacesService(); assertEquals(0, newVictim.getRecentlyUsedWorkspaces().size()); }
From source file:org.pdfsam.ui.PreferencesRecentWorkspacesService.java
@Override public void clear() { Preferences prefs = Preferences.userRoot().node(WORKSPACES_PATH); cache.clear();/* w ww . jav a 2 s. c om*/ try { prefs.removeNode(); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to clear recently used workspaces", e); } }
From source file:org.javaswift.cloudie.login.CredentialsStore.java
/** * deletes the credentials./* ww w.j a v a2 s . com*/ * @param cr the credentials. */ public void delete(Credentials cr) { try { Preferences prefs = Preferences.userNodeForPackage(CredentialsStore.class); prefs.node(cr.toString()).removeNode(); prefs.flush(); } catch (BackingStoreException ex) { throw new RuntimeException(ex); } }
From source file:org.javaswift.cloudie.login.CredentialsStore.java
/** * saves the given credentials.// w w w . j av a2 s . co m * @param cr the credentials. */ public void save(Credentials cr) { try { Preferences prefs = Preferences.userNodeForPackage(CredentialsStore.class); saveCredentials(prefs.node(cr.toString()), cr); prefs.flush(); } catch (BackingStoreException ex) { throw new RuntimeException(ex); } }
From source file:org.pdfsam.ui.PreferencesRecentWorkspacesServiceTest.java
@Test public void isSorted() throws BackingStoreException { Preferences node = Preferences.userRoot().node(WORKSPACES_PATH); node.put("2", "second"); node.put("3", "third"); node.put("1", "first"); node.flush(); PreferencesRecentWorkspacesService newVictim = new PreferencesRecentWorkspacesService(); List<String> workspaces = newVictim.getRecentlyUsedWorkspaces(); assertEquals(3, workspaces.size());//from www . jav a 2 s. com assertEquals("third", workspaces.get(0)); assertEquals("second", workspaces.get(1)); assertEquals("first", workspaces.get(2)); }
From source file:org.kuali.test.ui.components.dialogs.EmailDlg.java
/** * * @return// w w w.java 2 s.c om */ @Override protected boolean save() { boolean retval = false; boolean oktosave = true; if (StringUtils.isNotBlank(mailHost.getText()) && StringUtils.isNotBlank(subject.getText()) && StringUtils.isNotBlank(fromAddress.getText()) && StringUtils.isNotBlank(toAddresses.getText())) { } else { displayRequiredFieldsMissingAlert("Email Setup", "mail host, subject, from address, to addreses"); oktosave = false; } if (oktosave) { emailSetup.setMailHost(mailHost.getText()); emailSetup.setSubject(subject.getText()); emailSetup.setFromAddress(fromAddress.getText()); emailSetup.setToAddresses(toAddresses.getText()); Preferences proot = Preferences.userRoot(); Preferences node = proot.node(Constants.PREFS_ROOT_NODE); node.put(Constants.LOCAL_RUN_EMAIL, localRunAddress.getText()); try { node.flush(); } catch (BackingStoreException ex) { LOG.warn(ex.toString(), ex); } setSaved(true); getConfiguration().setModified(true); dispose(); retval = true; } return retval; }