Package java.util.prefs

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


     *
     * @see #save(java.lang.String)
     */
    public void load(String preferencesKey) throws BackingStoreException {
        Preferences prefs = Preferences.userRoot().node(preferencesKey);
        String[] keys = prefs.keys();
        if (keys != null) {
            for (String key : keys) {
                if (key.charAt(1) == '_') {
                    // Try loading using new method
                    switch (key.charAt(0)) {
View Full Code Here


    }

    private void readPreferences() {
        Preferences preferences = Preferences.userNodeForPackage(RSTAEditor.class);
        try {
            String[] keys = preferences.keys();
            for (String key : keys) {
                String value = preferences.get(key, null);
                handlePreference(key, value);
            }
        } catch (BackingStoreException e) {
View Full Code Here

     * preferences.
     */
    private void loadFileNames() {
        Preferences p = Preferences.userNodeForPackage(this.getClass());
        try {
            String[] keys = p.keys();
            for (int i = 0; i < keys.length; i++) {
                String fName = p.get("dirName" + i, null);
                if (fName == null)
                    continue;
                File file = new File(fName);
View Full Code Here

            Preferences jxl = prefs.node("autoupdate/jxl");
            for (int i = 0; i < files.length; i++) {
                File file = files[i];
                jxl.put("file" + i, file.getAbsolutePath());
            }
            for (int i = files.length, n = jxl.keys().length; i < n; i++) {
                jxl.remove("file" + i);
            }
        } catch (BackingStoreException e) {
        }
    }
View Full Code Here

    }

    public File[] getAutoUpdateJXLs() {
        try {
            Preferences jxls = prefs.node("autoupdate/jxl");
            String[] keys = jxls.keys();
            List fileList = new ArrayList();
            for (int i = 0; i < keys.length; i++) {
                fileList.add(new File(jxls.get(keys[i], null)));
            }
            return (File[]) fileList.toArray(new File[fileList.size()]);
View Full Code Here

    }

    private void populateFileHistory() {
        try {
            Preferences fileHistory = prefs.node("filehistory");
            String[] keys = fileHistory.keys();
            Arrays.sort(keys);
            for (int i = 0; i < keys.length; i++) {
                fileHistoryList.add(new File(fileHistory.get(keys[i], null)));
            }
        } catch (BackingStoreException e) {
View Full Code Here

    public static List<String> getLastProjFiles() {
        Preferences filesPrefs = getLastProjFilesPref();
        ArrayList<String> arrayLastProjFiles = new ArrayList<String>();
        String[] keys = null;
        try {
            keys = filesPrefs.keys();
        }
       
        catch (BackingStoreException e) {
            logObj.warn("Error reading preferences file.", e);
        }
View Full Code Here

        Collection details = new ArrayList<String>();
        String[] keys = null;
        ArrayList<String> values = new ArrayList<String>();

        try {
            keys = classLoaderPreference.keys();
            for (String cpKey : keys) {
              values.add(classLoaderPreference.get(cpKey, ""));
            }
        }
        catch (BackingStoreException e) {
View Full Code Here

                if (!equalsPath(oldNode, childNode)) {
                    // path to node
                    String path = childNode.absolutePath().replace(oldPath, newPath);

                    // copy all preferences in this node
                    String[] names = childNode.keys();
                    Preferences newPref = Preferences.userRoot().node(path);
                    for (int i = 0; i < names.length; i++) {
                        newPref.put(names[i], childNode.get(names[i], ""));
                    }
                    prefChild.add(newPref);
View Full Code Here

        assertEquals("8value", mock1.get("/K/E\\Y\\abc~@!#$%^&*(\\", null));
        assertNull(mock1.get("/k/e/y", null));
        assertEquals("7value", mock1.get("/K/E/Y", null));
        assertEquals("1value", mock1.get("key", null));

        String[] keys = mock1.keys();
        assertEquals(4, keys.length);
        for (int i = 0; i < keys.length; i++) {
            String key = keys[i];
            assertTrue("key".equals(key) || "KEY".equals(key)
                    || "/K/E/Y".equals(key)
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.