Package java.util.prefs

Examples of java.util.prefs.Preferences.sync()


      preferences.remove(FURNITURE_RESOURCES_REMOTE_URL_BASE);
    }
   
    try {
      // Write preferences
      preferences.sync();
    } catch (BackingStoreException ex) {
      throw new RecorderException("Couldn't write preferences", ex);
    }
  }
 
View Full Code Here


        if (value != null)
        {
          pref.put(key, value);
        }
      }
      pref.sync();
    }
    catch (BackingStoreException be)
    {
      throw new ConfigStoreException("Failed to store config" + configPath, be);
    }
View Full Code Here

    public static File getLastDirectory() {
        try {
            Preferences preferences = Preferences.userNodeForPackage(DBBrowserConfig.class);
            if (preferences != null) {
                try {
                    preferences.sync();
                } catch (BackingStoreException e) {
                }
                String path = preferences.get("directory", null);
                if (path != null) {
                    return new File(path);
View Full Code Here

    public static void loadWindowSize(String windowName, Window window) {
        try {
            Preferences preferences = Preferences.userNodeForPackage(DBBrowserConfig.class);
            if (preferences != null && window != null) {
                try {
                    preferences.sync();
                } catch (BackingStoreException e) {
                }
                int x = preferences.getInt("window." + windowName + ".x", -1);
                int y = preferences.getInt("window." + windowName + ".y", -1);
                int w = preferences.getInt("window." + windowName + ".width", -1);
View Full Code Here

        LinkedList<File> list = new LinkedList<File>();
        try {
            Preferences preferences = Preferences.userNodeForPackage(DBBrowserConfig.class);
            if (preferences != null) {
                try {
                    preferences.sync();
                } catch (BackingStoreException e) {
                }
                for (int i = 0; i < 5; i++) {
                    String path = preferences.get("recent." + i, null);
                    if (path == null) {
View Full Code Here

      spid = "default";
    }

    Preferences prefs     = prefsBase.node(NODE_NAME + "/" + spid + "/" + id);
    try {
      prefs.sync(); // Get the latest version of the node.
    } catch (Exception e) {
      errCount++;
      if(errCount < maxErr) {
        Activator.log.warn("Failed to get id=" + id, e);
      }
View Full Code Here

    }

    static void setPreference(final String name, final Object value, final boolean flush) {
        Preferences prefs = getPreferences();
        try {
            prefs.sync();
            if (value instanceof Long) {
                prefs.putLong(name, (Long) value);
            } else if (value instanceof Integer) {
                prefs.putInt(name, (Integer) value);
            } else if (value instanceof int[]) {
View Full Code Here

    }

    static int getPreference(final String name, final int defaultValue) {
        Preferences prefs = getPreferences();
        try {
            prefs.sync();
            return prefs.getInt(name, defaultValue);
        } catch (BackingStoreException ioe) {
            // ignore
        }
        return defaultValue;
View Full Code Here

    }

    static int[] getPreference(final String name, final int[] defaultValues) {
        Preferences prefs = getPreferences();
        try {
            prefs.sync();
            String value = prefs.get(name, null);
            if (value != null) {
                String[] values = value.split(",");
                int[] result = new int[values.length];
                for (int i = 0; i < values.length; i++) {
View Full Code Here

            XmlDocument doc = new XmlDocument(ExportTag);
            LastExportOptions.write(doc.getRoot());
            saveXmlPrefs(ExportTag, doc);
        }
        try {
            prefs.sync();
        }
        catch (BackingStoreException e) {
            showError(LOCALE.get("PrefsWriteError"), e, null);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.