Java Code Examples for java.util.prefs.Preferences

The following are top voted examples for showing how to use java.util.prefs.Preferences. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: ProxyPreferencesImplTest.java   Source Code and License 7 votes vote down vote up
private void checkContains(Preferences prefs, String[] tree, String prefsId) throws BackingStoreException {
    for(String s : tree) {
        int equalIdx = s.lastIndexOf('=');
        assertTrue(equalIdx != -1);
        String value = s.substring(equalIdx + 1);

        String key;
        String nodePath;
        int slashIdx = s.lastIndexOf('/', equalIdx);
        if (slashIdx != -1) {
            key = s.substring(slashIdx + 1, equalIdx);
            nodePath = s.substring(0, slashIdx);
        } else {
            key = s.substring(0, equalIdx);
            nodePath = "";
        }

        assertTrue(prefsId + " doesn't contain node '" + nodePath + "'", prefs.nodeExists(nodePath));
        Preferences node = prefs.node(nodePath);

        String realValue = node.get(key, null);
        assertNotNull(prefsId + ", '" + nodePath + "' node doesn't contain key '" + key + "'", realValue);
        assertEquals(prefsId + ", '" + nodePath + "' node, '" + key + "' contains wrong value", value, realValue);
    }
}
 
Example 2
Project: incubator-netbeans   File: ProfilerIDESettings.java   Source Code and License 6 votes vote down vote up
private void storeProfilingSettings(ProfilingSettings settings) {
    Preferences pref = getPreferences();
    
    pref.putInt(ProfilingSettings.PROP_SAMPLING_FREQUENCY, settings.getSamplingFrequency());
    pref.putInt(ProfilingSettings.PROP_CPU_PROFILING_TYPE, settings.getCPUProfilingType());
    pref.putInt(ProfilingSettings.PROP_SAMPLING_INTERVAL, settings.getSamplingInterval());
    pref.putBoolean(ProfilingSettings.PROP_EXCLUDE_WAIT_TIME, settings.getExcludeWaitTime());
    pref.putBoolean(ProfilingSettings.PROP_INSTRUMENT_SPAWNED_THREADS, settings.getInstrumentSpawnedThreads());
    pref.putInt(ProfilingSettings.PROP_N_PROFILED_THREADS_LIMIT, settings.getNProfiledThreadsLimit());
    pref.putInt(ProfilingSettings.PROP_INSTR_SCHEME, settings.getInstrScheme());
    pref.putBoolean(ProfilingSettings.PROP_INSTRUMENT_METHOD_INVOKE, settings.getInstrumentMethodInvoke());
    pref.putBoolean(ProfilingSettings.PROP_INSTRUMENT_GETTER_SETTER_METHODS, settings.getInstrumentGetterSetterMethods());
    pref.putBoolean(ProfilingSettings.PROP_INSTRUMENT_EMPTY_METHODS, settings.getInstrumentEmptyMethods());
    
    pref.putInt(ProfilingSettings.PROP_OBJ_ALLOC_STACK_SAMPLING_INTERVAL, settings.getAllocTrackEvery());
    pref.putBoolean(ProfilingSettings.PROP_RUN_GC_ON_GET_RESULTS_IN_MEMORY_PROFILING, settings.getRunGCOnGetResultsInMemoryProfiling());
    
    pref.putBoolean(ProfilingSettings.PROP_THREADS_SAMPLING_ENABLED, settings.getThreadsSamplingEnabled());
}
 
Example 3
Project: boomer-tuner   File: RootView.java   Source Code and License 6 votes vote down vote up
private void setImages() {
    Preferences preferences = Preferences.userNodeForPackage(Player.class);

    volDown.setGraphic(volDownImage);
    volUp.setGraphic(volUpImage);
    previous.setGraphic(previousImage);
    play.setGraphic(playImage);
    next.setGraphic(nextImage);

    final boolean isShuffleMode = preferences.getBoolean("ShuffleMode", false);
    shuffle.setGraphic(isShuffleMode ? shufflePressedImage : shuffleImage);

    final boolean isLoopMode = preferences.getBoolean("LoopMode", false);
    loop.setGraphic(isLoopMode ? loopPressedImage: loopImage);

    volSlider.valueChangingProperty().addListener(rootController.volumeUpdated(volSlider));
}
 
Example 4
Project: incubator-netbeans   File: FallbackProvider.java   Source Code and License 6 votes vote down vote up
private boolean promptToDelete(Preferences prefs) {
    Object result = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
            NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.msg_clear_keys"),
            NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.title_clear_keys"),
            NotifyDescriptor.OK_CANCEL_OPTION));
    if (result == NotifyDescriptor.OK_OPTION) {
        try {
            LOG.log(Level.FINE, "agreed to delete stored passwords: {0}", Arrays.asList(prefs.keys()));
            prefs.clear();
            return testSampleKey(prefs);
        } catch (BackingStoreException x) {
            LOG.log(Level.INFO, null, x);
        }
    } else {
        LOG.fine("refused to delete stored passwords");
    }
    return false;
}
 
Example 5
Project: incubator-netbeans   File: FmtCodeGeneration.java   Source Code and License 6 votes vote down vote up
@Override
protected void storeListData(final JList list, final String optionID, final Preferences node) {
    StringBuilder sb = null;
    for (int i = 0; i < list.getModel().getSize(); i++) {
        if (sb == null) {
            sb = new StringBuilder();
        } else {
            sb.append(';');
        }
        if (classMembersOrder.equals(optionID)) {
            Element e = (Element) list.getModel().getElementAt(i);
            if (e.isStatic)
                sb.append("STATIC "); //NOI18N
            sb.append(e.kind.name());
        } else {
            Visibility v = (Visibility) list.getModel().getElementAt(i);
            sb.append(v.kind);
        }
    }
    String value = sb != null ? sb.toString() : ""; //NOI18N
    if (getDefaultAsString(optionID).equals(value))
        node.remove(optionID);
    else
        node.put(optionID, value);            
}
 
Example 6
Project: Conan   File: Proof.java   Source Code and License 6 votes vote down vote up
private void generateRow(int rowIndex) {
    Preferences prefs = userRoot().node("General");
    if (!prefs.getBoolean("generate", true))
        return;
    assert (rowIndex < proofData.size());
    ProofRow row = proofData.getRow(rowIndex);
    Rule rule = row.getRule();
    if (rule == null || rule.hasCompleteInfo() == false || row.getFormula() != null) {
        return;
    }
    Formula generated = null;
    try {
        generated = rule.generateFormula(proofData, rowIndex);
    } catch (VerificationInputException e) {
        return;
    }
    if (generated == null)
        return;
    row.setFormula(generated);
    for (ProofListener listener : this.listeners) {
        listener.rowUpdated(generated.toString(), true, rowIndex + 1);
    }
}
 
Example 7
Project: incubator-netbeans   File: ProjectAwareCodeStylePreferences.java   Source Code and License 6 votes vote down vote up
private void initProjectPreferences(final FileObject file) {
    ProjectManager.mutex().postReadRequest(new Runnable() {
        public @Override void run() {
            Preferences projectRoot = findProjectPreferences(file);
            if (projectRoot != null) {
                synchronized (Csp.this) {
                    Preferences allLangCodeStyle = projectRoot.node(NODE_CODE_STYLE);
                    Preferences p = allLangCodeStyle.node(PROJECT_PROFILE);

                    // determine if we are using code style preferences from the project
                    String usedProfile = allLangCodeStyle.get(PROP_USED_PROFILE, DEFAULT_PROFILE);
                    useProject = PROJECT_PROFILE.equals(usedProfile);
                    projectPrefs = Csp.this.mimeType == null ?
                        p :
                        new ProxyPreferences(projectRoot.node(Csp.this.mimeType).node(NODE_CODE_STYLE).node(PROJECT_PROFILE), p);

                    // listen on changes
                    allLangCodeStyle.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, switchTrakcer, allLangCodeStyle));
                }
            }
        }
    });
    LOG.fine("file '" + filePath + "' (" + mimeType + ") is using " + (useProject ? "project" : "global") + " Preferences; doc=" + s2s(refDoc == null ? null : refDoc.get())); //NOI18N
}
 
Example 8
Project: incubator-netbeans   File: ProxyPreferencesImplTest.java   Source Code and License 6 votes vote down vote up
/** 
 * Checks that modifications to the ihnerited store are not fired if
 * the local store overrides
 */
public void testInheritedEventsMasked() throws Exception {
    Preferences stored = new MapPreferences();
    Preferences inherited = new MapPreferences();
    
    inherited.putInt("intValue", 100);
    stored.putInt("intValue", 10);

    MemoryPreferences mem = MemoryPreferences.getWithInherited(this, inherited, stored);
    Preferences test = mem.getPreferences();
    
    PL pl = new PL();
    test.addPreferenceChangeListener(pl);
    
    // change
    pl.arm();
    inherited.putInt("intValue", 3);
    pl.waitEvent();
    assertEquals(0, pl.changeCount);
    
    // remove not inherited
    pl.arm();
    inherited.remove("intValue");
    pl.waitEvent();
    assertEquals(0, pl.changeCount);
}
 
Example 9
Project: incubator-netbeans   File: ReflectiveCustomizerProvider.java   Source Code and License 6 votes vote down vote up
private JComponent createBooleanOption(OptionDescriptor option, Preferences prefs)  {
    JCheckBox checkBox = new JCheckBox();

    org.openide.awt.Mnemonics.setLocalizedText(checkBox, option.displayName);
    checkBox.setToolTipText(option.tooltip);
    checkBox.addActionListener(new ActionListenerImpl(option.preferencesKey, prefs));

    checkBox.setSelected(prefs.getBoolean(option.preferencesKey, 
            Boolean.TRUE == option.defaultValue));
    prefs.putBoolean(option.preferencesKey, checkBox.isSelected());
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridheight = 1;
    constraints.gridwidth = 2;
    constraints.gridx = 0;
    constraints.gridy = row++;
    constraints.weightx = 0;
    constraints.weighty = 0;

    add(checkBox, constraints);
    return checkBox;
}
 
Example 10
Project: incubator-netbeans   File: RepositoryUpdater.java   Source Code and License 6 votes vote down vote up
private Preferences indexerProfileNode(SourceIndexerFactory srcFactory) {
    String nn = srcFactory.getIndexerName();
    if (nn.length() >= Preferences.MAX_NAME_LENGTH) {
        // such long nodes are constructer e.g. from class names
        int i = nn.lastIndexOf('.');
        if (i >= 0) {
            nn = nn.substring(i + 1);
        }
        if (nn.length() < 3 || nn.length() >= Preferences.MAX_NAME_LENGTH) {
            String hashCode = Integer.toHexString(nn.hashCode());
            // attempt to derive +- unique node name
            nn = srcFactory.getClass().getSimpleName() + "_" + hashCode; // NOI18N
        }
    }
    return NbPreferences.forModule(srcFactory.getClass()).node("RepositoryUpdater"). // NOI18N
            node(nn);
}
 
Example 11
Project: jdk8u-jdk   File: SoftSynthesizer.java   Source Code and License 6 votes vote down vote up
private Properties getStoredProperties() {
    return AccessController
            .doPrivileged((PrivilegedAction<Properties>) () -> {
                Properties p = new Properties();
                String notePath = "/com/sun/media/sound/softsynthesizer";
                try {
                    Preferences prefroot = Preferences.userRoot();
                    if (prefroot.nodeExists(notePath)) {
                        Preferences prefs = prefroot.node(notePath);
                        String[] prefs_keys = prefs.keys();
                        for (String prefs_key : prefs_keys) {
                            String val = prefs.get(prefs_key, null);
                            if (val != null) {
                                p.setProperty(prefs_key, val);
                            }
                        }
                    }
                } catch (final BackingStoreException ignored) {
                }
                return p;
            });
}
 
Example 12
Project: incubator-netbeans   File: ProxyPreferencesImplTest.java   Source Code and License 6 votes vote down vote up
public void testFlushTree1() throws BackingStoreException {
    String [] origTree = new String [] {
        "CodeStyle/profile=GLOBAL",
    };
    String [] newTree = new String [] {
        "CodeStyle/text/x-java/tab-size=2",
        "CodeStyle/text/x-java/override-global-settings=true",
        "CodeStyle/text/x-java/expand-tabs=true",
        "CodeStyle/profile=PROJECT",
    };

    Preferences orig = Preferences.userRoot().node(getName());
    write(orig, origTree);
    checkContains(orig, origTree, "Orig");
    checkNotContains(orig, newTree, "Orig");
    
    Preferences test = ProxyPreferencesImpl.getProxyPreferences(this, orig);
    checkEquals("Test should be the same as Orig", orig, test);
    
    write(test, newTree);
    checkContains(test, newTree, "Test");

    test.flush();
    checkEquals("Test didn't flush to Orig", test, orig);
}
 
Example 13
Project: incubator-netbeans   File: SideBarFactoryImpl.java   Source Code and License 6 votes vote down vote up
public SideBar(Document forDocument) {
    super(new BorderLayout());
    this.forDocument = forDocument;
    add(new BreadCrumbComponent(), BorderLayout.CENTER);

    JButton closeButton = CloseButtonFactory.createBigCloseButton();

    add(closeButton, BorderLayout.EAST);
    
    prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
    prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, this, prefs));
    
    closeButton.addActionListener(new ActionListener() {
        @Override public void actionPerformed(ActionEvent e) {
            prefs.putBoolean(KEY_BREADCRUMBS, false);
        }
    });
    
    setBorder(new SeparatorBorder());
    preferenceChange(null);
}
 
Example 14
Project: incubator-netbeans   File: CategorySupport.java   Source Code and License 6 votes vote down vote up
protected CategorySupport(Preferences preferences, String id, JPanel panel, String previewText, String[]... forcedOptions) {
    this.preferences = preferences;
    this.id = id;
    this.panel = panel;
    this.previewText = previewText != null ? previewText : NbBundle.getMessage(CategorySupport.class, "SAMPLE_Default"); //NOI18N

    // Scan the panel for its components
    scan(panel, components);

    // Initialize the preview preferences
    Preferences forcedPrefs = new PreviewPreferences();
    for (String[] option : forcedOptions) {
        forcedPrefs.put( option[0], option[1]);
    }
    this.previewPrefs = new ProxyPreferences(forcedPrefs, preferences);

    // Load and hook up all the components
    loadFrom(preferences);
    addListeners();
}
 
Example 15
Project: incubator-netbeans   File: IntroduceHintTest.java   Source Code and License 6 votes vote down vote up
public void testFieldFix208072d() throws Exception {
    Preferences prefs = CodeStylePreferences.get((FileObject) null, JavacParser.MIME_TYPE).getPreferences();
    prefs.put("classMembersOrder", "STATIC_INIT;STATIC METHOD;INSTANCE_INIT;CONSTRUCTOR;METHOD;STATIC CLASS;CLASS;STATIC FIELD;FIELD");
    prefs.put("classMemberInsertionPoint", "LAST_IN_CATEGORY");
    performFixTest("package test;\n" +
                   "import java.util.logging.Level;\n" +
                   "import java.util.logging.Logger;\n" +
                   "public class Test {\n" +
                   "     static {\n" +
                   "         int ii = |1 + 2 * 3|;\n" +
                   "     }\n" +
                   "     private static final int II = 0;\n" +
                   "}\n",
                   ("package test;\n" +
                    "import java.util.logging.Level;\n" +
                    "import java.util.logging.Logger;\n" +
                    "public class Test {\n" +
                   "     private static int ZZ = 1 + 2 * 3;\n" +
                   "     static {\n" +
                   "         int ii = ZZ;\n" +
                   "     }\n" +
                   "     private static final int II = 0;\n" +
                    "}\n").replaceAll("[ \t\n]+", " "),
                   new DialogDisplayerImpl2("ZZ", IntroduceFieldPanel.INIT_FIELD, false, EnumSet.<Modifier>of(Modifier.PRIVATE), false, true),
                   5, 2);
}
 
Example 16
Project: incubator-netbeans   File: ConfigurationsManager.java   Source Code and License 6 votes vote down vote up
private void init() {
    Preferences prefs = getConfigurationsRoot();
    try {
        for (String kid:prefs.childrenNames()) {
            if (kid.startsWith(RULE_PREFIX)) {
                Preferences p = prefs.node(kid);
                String displayName = p.get("display.name", "unknown");
                create(kid.substring(RULE_PREFIX.length()), displayName);
            }
        }
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
    if (configs.isEmpty()) {
        create("default", NbBundle.getMessage(ConfigurationsManager.class, "DN_Default"));
    }
    prefs.putInt(KEY_CONFIGURATIONS_VERSION, CURRENT_CONFIGURATIONS_VERSION);
}
 
Example 17
Project: incubator-netbeans   File: SourceJavadocByHash.java   Source Code and License 6 votes vote down vote up
public static @CheckForNull File[] find(@NonNull URL root, boolean javadoc) {
    String k = root.toString();
    Preferences n = node(javadoc);
    String v = n.get(k, null);
    if (v == null) {
        return null;
    }
    String[] split = StringUtils.split(v, "||");
    List<File> toRet = new ArrayList<File>();
    for (String vv : split) {
        File f = FileUtilities.convertStringToFile(vv);
        if (f.isFile()) {
            toRet.add(f);
        } else {
            //what do we do when one of the possibly more files is gone?
            //in most cases we are dealing with exactly one file, so keep the
            //previous behaviour of removing it.
            n.remove(k);
        }
    }
    return toRet.toArray(new File[0]);
}
 
Example 18
Project: pdfjumbler   File: PdfProcessingFactory.java   Source Code and License 5 votes vote down vote up
private static void selectInitialEditor() {
	List<Class<? extends PdfEditor>> classes = new ArrayList<>(pdfEditorClasses.size() + 2);
	classes.add(findEditorClass(
		System.getProperty("pdfjumbler.editor", null)
	));
	classes.add(findEditorClass(
		Preferences.userNodeForPackage(PdfJumbler.class).get("editor", null)
	));
	classes.addAll(pdfEditorClasses);
	
	for (Class<? extends PdfEditor> cls : classes) {
		if (cls == null) {
			continue;
		}
		System.err.print("Trying to instantiate editor: " + cls + "... ");
		try {
			editor = cls.newInstance();
		}
		catch (Exception e) {
			System.err.println("Error: " + e.getClass().getCanonicalName());
			e.printStackTrace();
			continue;
		}
		System.err.println("ok.");
		break;
	}
	if (editor == null) {
		JOptionPane.showMessageDialog(
			null,
			resources.getString("NO_PDF_EDITOR_TEXT"),
			resources.getString("NO_PDF_EDITOR_TITLE"),
			JOptionPane.ERROR_MESSAGE
		);
		System.exit(101);
	}
}
 
Example 19
Project: incubator-netbeans   File: ReindenterTest.java   Source Code and License 5 votes vote down vote up
public void testNewLineIndentationBeforeAbsolutLabeledStatement() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("absoluteLabelIndent", true);
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n    public void op() {|mylabel:\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\nmylabel:\n    }\n}\n");
    } finally {
        preferences.remove("absoluteLabelIndent");
    }
}
 
Example 20
Project: incubator-netbeans   File: FmtOptions.java   Source Code and License 5 votes vote down vote up
@Override
protected String getSpi(String key) {
    for(Preferences p : delegates) {
        String value = p.get(key, null);
        if (value != null) {
            return value;
        }
    }
    return null;
}
 
Example 21
Project: Matcher   File: ProjectConfig.java   Source Code and License 5 votes vote down vote up
public static ProjectConfig getLast() {
	Preferences prefs = Preferences.userRoot();

	try {
		if (prefs.nodeExists(userPrefFolder)
				&& (prefs = prefs.node(userPrefFolder)).nodeExists(userPrefKey)
				&& (prefs = prefs.node(userPrefKey)).nodeExists(pathsAKey) && prefs.nodeExists(pathsBKey) && prefs.nodeExists(pathsSharedKey)) {
			Function<String, Path> deserializer = str -> Paths.get(str);

			List<Path> pathsA = loadList(prefs.node(pathsAKey), deserializer);
			List<Path> pathsB = loadList(prefs.node(pathsBKey), deserializer);
			List<Path> classPathA = loadList(prefs.node(classPathAKey), deserializer);
			List<Path> classPathB = loadList(prefs.node(classPathBKey), deserializer);
			List<Path> pathsShared = loadList(prefs.node(pathsSharedKey), deserializer);
			boolean inputsBeforeClassPath = prefs.getBoolean(inputsBeforeClassPathKey, false);

			ProjectConfig ret = new ProjectConfig(pathsA, pathsB, classPathA, classPathB, pathsShared, inputsBeforeClassPath);

			ret.setUidSettings(prefs.get("uidHost", null),
					prefs.getInt("uidPort", 0),
					prefs.get("uidUser", null),
					prefs.get("uidPassword", null),
					prefs.get("uidProject", null),
					prefs.get("uidVersionA", null),
					prefs.get("uidVersionB", null));

			return ret;
		}
	} catch (BackingStoreException e) { }

	return new ProjectConfig();
}
 
Example 22
Project: incubator-netbeans   File: TestPreferences.java   Source Code and License 5 votes vote down vote up
public void testAddPreferenceChangeListener() throws BackingStoreException, InterruptedException {
    final Preferences pref = getPreferencesNode();
    PreferenceChangeListener l = new PreferenceChangeListener() {
        public void preferenceChange(PreferenceChangeEvent evt) {
            synchronized (TestPreferences.class) {
                //assertionerrors cause deadlock here
                assertSame(pref, evt.getNode());
                assertEquals("key", evt.getKey());
                assertEquals(evt.getNewValue(),pref.get(evt.getKey(),null), evt.getNewValue());
                TestPreferences.class.notifyAll();
            }
        }
    };
    pref.addPreferenceChangeListener(l);
    try {
        synchronized (TestPreferences.class) {
            pref.put("key","AddPreferenceChangeListener");
            pref.flush();
            TestPreferences.class.wait();
        }
        
        synchronized (TestPreferences.class) {
            pref.remove("key");
            pref.flush();
            TestPreferences.class.wait();
        }
        
        synchronized (TestPreferences.class) {
            pref.put("key","AddPreferenceChangeListener2");
            pref.flush();
            TestPreferences.class.wait();
        }
    } finally {
        pref.removePreferenceChangeListener(l);
    }
}
 
Example 23
Project: incubator-netbeans   File: JPDABreakpoint.java   Source Code and License 5 votes vote down vote up
JPDABreakpoint () {
    Preferences preferences = NbPreferences.forModule(getClass()).node("debugging"); // NOI18N
    int num = preferences.getInt("default.suspend.action", -1); // NOI18N [TODO] create property name constant, use it in ActionsPanel
    if (num == -1) {
        Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
        num = p.getInt("BreakpointSuspend", JPDABreakpoint.SUSPEND_EVENT_THREAD);
    }
    switch (num) {
        case 0: suspend = SUSPEND_NONE; break;
        case 1: suspend = SUSPEND_EVENT_THREAD; break;
        case 2: suspend = SUSPEND_ALL;
    }
}
 
Example 24
Project: incubator-netbeans   File: ConstantNameHint.java   Source Code and License 5 votes vote down vote up
public static List<String> getImmutableTypes(Preferences p) {
    String val = p.get(PREF_IMMUTABLE_CLASSES, "");
    StringTokenizer tukac = new StringTokenizer(", ", val);
    List<String> res = new ArrayList<>(3);
    while (tukac.hasMoreTokens()) {
        String token = tukac.nextToken();
        if (token.isEmpty()) {
            continue;
        }
        res.add(token);
    }
    return res;
}
 
Example 25
Project: Steam-trader-tools   File: Main.java   Source Code and License 5 votes vote down vote up
@Override
public void start(final Stage primaryStage) throws Exception
{
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.getIcons().add(new Image("/com/matthieu42/steamtradertools/bundles/images/Icon_STTBluepng.png"));
    Preferences prefs = Preferences.userNodeForPackage(com.matthieu42.steamtradertools.model.Main.class);
    String language = prefs.get(PreferencesKeys.LANGUAGE.toString(),Locale.ENGLISH.getDisplayLanguage());
    Locale locale;
    if(language.equals(Locale.FRENCH.getDisplayLanguage()))
    {
        locale = Locale.FRENCH;
    }
    else
        locale = Locale.ENGLISH;
    I18n.setLocale(locale);
    I18n.setBundle("com/matthieu42/steamtradertools/bundles/lang",locale);
    final AllAppList allAppList = new AllAppList();
    final UserAppList userAppList = new UserAppList();

    File steamAppList = new File("steamAppList.xml");
    if (!steamAppList.exists())
    {
        FXMLLoader splashLoader = new FXMLLoader(getClass().getResource("/com/matthieu42/steamtradertools/view/loadview.fxml"),I18n.getResourceBundle());
        AnchorPane pane = splashLoader.load();
        primaryStage.setScene(new Scene(pane));
        primaryStage.show();
        Task<Void> syncApp = allAppList.init();
        syncApp.setOnSucceeded(t ->
        {
            allAppList.saveToXml();
            continueLaunch(allAppList,userAppList,primaryStage);
        });

        syncApp.setOnFailed(t ->
        {
            return;
        });
        new Thread(syncApp).start();
    } else
    {
        allAppList.loadFromXml();
        continueLaunch(allAppList,userAppList,primaryStage);
    }
}
 
Example 26
Project: incubator-netbeans   File: Utilities.java   Source Code and License 5 votes vote down vote up
private static void lazyInit() {
    if (inited.compareAndSet(false, true)) {
        preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
        preferences.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, preferencesTracker, preferences));
        preferencesTracker.preferenceChange(null);
    }
}
 
Example 27
Project: MaxSim   File: CfgPreferences.java   Source Code and License 5 votes vote down vote up
public void setFlagsSetting(FlagsSetting flagsSetting) {
    FlagsSetting old = this.getFlagsSetting();
    this.flagsSetting = flagsSetting;
    Preferences prefs = getPreferences();
    firePropertyChange(PROP_FLAGS, old, flagsSetting);
    prefs.put(PROP_FLAGS, flagsSetting.getFlagString());
}
 
Example 28
Project: incubator-netbeans   File: CategorySupport.java   Source Code and License 5 votes vote down vote up
protected String getSpi(String key) {
    for(Preferences p : delegates) {
        String value = p.get(key, null);
        if (value != null) {
            return value;
        }
    }
    return null;
}
 
Example 29
Project: incubator-netbeans   File: ShellSession.java   Source Code and License 5 votes vote down vote up
private Preferences createShellPreferences() {
    Project p = env.getProject();
    if (p != null) {
        return ProjectUtils.getPreferences(p, ShellSession.class, false).node("jshell");
    } else {
        return NbPreferences.forModule(ShellSession.class).node("jshell");
    }
}
 
Example 30
Project: incubator-netbeans   File: WrongStringComparison.java   Source Code and License 5 votes vote down vote up
@Override
public JComponent getCustomizer(Preferences prefs) {
    JComponent customizer = new WrongStringComparisonCustomizer(prefs);
    prefs.putBoolean(STRING_LITERALS_FIRST, getStringLiteralsFirst(prefs));
    prefs.putBoolean(TERNARY_NULL_CHECK, getTernaryNullCheck(prefs));
    return customizer;
}
 
Example 31
Project: incubator-netbeans   File: HintsPanelLogic.java   Source Code and License 5 votes vote down vote up
public void store( Preferences target ) {
    
    try {
        for (String key : keys()) {
            target.put(key, get(key, null));
        }
    }
    catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }

}
 
Example 32
Project: EditCalculateAndChart   File: Preferences_Action.java   Source Code and License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
      javax.swing.SwingUtilities.invokeLater(() -> {
                               try {
                                  // final JFrame f = new JFrame("Preferences");
                                   final FontChooser2 fc = new FontChooser2(TEdit);
                                        fc.setResizable(false);
                                        fc.setVisible(true);
                                        Font myNewFont = fc.getSelectedFont();
                                            // System.out.println("You chose " + myNewFont);
                                       if(myNewFont!=null){     
                                         TEdit.getTextArea().setFont(myNewFont);
                                         Preferences Config = TEdit.getConfig();
                                         Config.put("FONT_NAME",myNewFont.getName());
                                         Config.putInt("FONT_SIZE",myNewFont.getSize());
                                         Config.putInt("FONT_STYLE", myNewFont.getStyle());
                                         Config.putInt("PRECISION",jc.MC.getPrecision());
                                         Config.flush();
                                       }
                                         //f.pack(); // adjust for new size
                                          fc.dispose();
                               } catch (Exception e1) {
                                   System.out.println(e1.getMessage());
                               }
                           });
   // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
Example 33
Project: dead-code-detector   File: Parameters.java   Source Code and License 5 votes vote down vote up
/**
 * Charge les paramètres depuis les préférences utilisateur.
 * @return Parameters
 * @throws BackingStoreException e
 */
public static Parameters createFromUserPreferences() throws BackingStoreException {
	final Properties properties = new Properties();
	final Preferences prefs = Preferences.userNodeForPackage(Parameters.class);
	for (final String key : prefs.keys()) {
		final String value = prefs.get(key, null);
		if (value != null && !value.isEmpty()) {
			properties.put(key, value);
		}
	}
	return new Parameters(properties);
}
 
Example 34
Project: vars-annotation   File: ConceptButtonPaneController.java   Source Code and License 5 votes vote down vote up
private void loadButtonsFromPreferences() {
    // TODO show a loading symbol
    ConceptButtonFactory factory =
            new ConceptButtonFactory(conceptService, eventBus, i18n);
    try {
        List<Button> buttons = Arrays.stream(panePreferences.childrenNames())
                .map(nodeName -> {
                    Preferences buttonPreferences = panePreferences.node(nodeName);
                    String conceptName = buttonPreferences.get(PREF_BUTTON_NAME, BAD_KEY);
                    int order = buttonPreferences.getInt(PREF_BUTTON_ORDER, 0);
                    Button button = factory.build(conceptName);
                    return new ButtonPref(button, order);
                })
                .filter(buttonPref -> !buttonPref.getButton().getText().equals(BAD_KEY))
                .sorted(Comparator.comparingInt(ButtonPref::getOrder))
                .map(ButtonPref::getButton)
                .collect(Collectors.toList());
        getPane().getChildren().addAll(buttons);
    }
    catch (Exception e) {
        eventBus.send(new ShowNonfatalErrorAlert(
                i18n.getString("cbpanel.alert.prefsfail.load.title"),
                i18n.getString("cbpanel.alert.prefsfail.load.header"),
                i18n.getString("cbpanel.alert.prefsfail.load.content"),
                e));
    }

}
 
Example 35
Project: incubator-netbeans   File: Configuration.java   Source Code and License 5 votes vote down vote up
/** Gets current severiry of the hint.
 * @return Hints severity in current profile.
 */
public final HintSeverity getSeverity(Preferences p) {
    String s = p.get(SEVERITY_KEY, null );
    HintSeverity severity = s == null ? defaultSeverity : fromPreferenceString(s);
    if(!id2Saved.containsKey(SEVERITY_KEY)) {
        id2Saved.put(SEVERITY_KEY, severity);
    }
    return severity;
}
 
Example 36
Project: incubator-netbeans   File: EditorRenderingHints.java   Source Code and License 5 votes vote down vote up
public static synchronized EditorRenderingHints get(MimePath mimePath) {
    EditorRenderingHints erh = CACHE.get(mimePath);
    if (erh == null) {
        Preferences prefs = MimeLookup.getLookup(mimePath).lookup(Preferences.class);
        erh = new EditorRenderingHints(prefs);
        CACHE.put(mimePath, erh);
    }
    return erh;
}
 
Example 37
Project: incubator-netbeans   File: Configuration.java   Source Code and License 5 votes vote down vote up
public Preferences getPreferences() {
//        Map<String, Preferences> override = HintsSettings.getPreferencesOverride();
//        if (override != null) {
//            Preferences p = override.get(getId());
//            if (p != null) {
//                return p;
//            }
//        }
        return NbPreferences.forModule(this.getClass()).node(getId()); //NOI18N
    }
 
Example 38
Project: incubator-netbeans   File: OnSaveTabPanelController.java   Source Code and License 5 votes vote down vote up
private boolean arePrefsChanged(String mimeType) {
    boolean isChanged = false;
    Preferences prefs = selector.getPreferences(mimeType);
    Preferences savedPrefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    HashSet<String> hashSet = new HashSet<String>();
    try {
        hashSet.addAll(Arrays.asList(prefs.keys()));
        hashSet.addAll(Arrays.asList(savedPrefs.keys()));
    } catch (BackingStoreException ex) {
        return false;
    }
    for (String key : hashSet) {
        String current = prefs.get(key, null);
        String saved = savedPrefs.get(key, null);
        if (saved == null) {
            if (key.equals(SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE) || key.equals(SimpleValueNames.ON_SAVE_REFORMAT)) {
                saved = "never"; // NOI18N
            } else if (key.equals(SimpleValueNames.ON_SAVE_USE_GLOBAL_SETTINGS)) {
                saved = "true"; // NOI18N
            } else {
                saved = selector.getSavedValue(mimeType, key);
            }
        }
        isChanged |= current == null ? saved != null : !current.equals(saved);
        if (isChanged) { // no need to iterate further
            return true;
        }
    }
    return isChanged;
}
 
Example 39
Project: vogar   File: TestEnvironment.java   Source Code and License 5 votes vote down vote up
public void reset() {
    // Reset system properties.
    System.setProperties(null);

    // From "L" release onwards, calling System.setProperties(null) clears the java.io.tmpdir,
    // so we set it again. No-op on earlier releases.
    System.setProperty("java.io.tmpdir", tmpDir);

    if (JAVA_RUNTIME_VERSION != null) {
        System.setProperty("java.runtime.version", JAVA_RUNTIME_VERSION);
    }
    if (JAVA_VM_INFO != null) {
        System.setProperty("java.vm.info", JAVA_VM_INFO);
    }
    if (JAVA_VM_VERSION != null) {
        System.setProperty("java.vm.version", JAVA_VM_VERSION);
    }
    if (JAVA_VM_VENDOR != null) {
        System.setProperty("java.vm.vendor", JAVA_VM_VENDOR);
    }
    if (JAVA_VM_NAME != null) {
        System.setProperty("java.vm.name", JAVA_VM_NAME);
    }

    // Require writable java.home and user.dir directories for preferences
    if ("Dalvik".equals(System.getProperty("java.vm.name"))) {
        String javaHome = tmpDir + "/java.home";
        IoUtils.safeMkdirs(new File(javaHome));
        System.setProperty("java.home", javaHome);
    }
    String userHome = System.getProperty("user.home");
    if (userHome.length() == 0) {
        userHome = tmpDir + "/user.home";
        IoUtils.safeMkdirs(new File(userHome));
        System.setProperty("user.home", userHome);
    }

    // Localization
    Locale.setDefault(Locale.US);
    TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));

    // Preferences
    // Temporarily silence the java.util.prefs logger, which otherwise emits
    // an unactionable warning. See RI bug 4751540.
    Logger loggerToMute = Logger.getLogger("java.util.prefs");
    boolean usedParentHandlers = loggerToMute.getUseParentHandlers();
    loggerToMute.setUseParentHandlers(false);
    try {
        // resetPreferences(Preferences.systemRoot());
        resetPreferences(Preferences.userRoot());
    } finally {
        loggerToMute.setUseParentHandlers(usedParentHandlers);
    }

    // HttpURLConnection
    Authenticator.setDefault(null);
    CookieHandler.setDefault(null);
    ResponseCache.setDefault(null);
    HttpsURLConnection.setDefaultHostnameVerifier(defaultHostnameVerifier);
    HttpsURLConnection.setDefaultSSLSocketFactory(defaultSSLSocketFactory);

    // Logging
    LogManager.getLogManager().reset();
    Logger.getLogger("").addHandler(new ConsoleHandler());

    // Cleanup to force CloseGuard warnings etc
    System.gc();
    System.runFinalization();
}
 
Example 40
Project: incubator-netbeans   File: ReindenterTest.java   Source Code and License 5 votes vote down vote up
public void testLineIndentationBeforeHalfIndentedNewArrayInit() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("otherBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performLineIndentationTest("package t;\npublic class T {\n    public void op() {\n        int[] arr = new int[]\n|                {\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        int[] arr = new int[]\n          {\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
Example 41
Project: Logisim   File: PrefMonitorDouble.java   Source Code and License 5 votes vote down vote up
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		double oldValue = value;
		double newValue = prefs.getDouble(name, dflt);
		if (newValue != oldValue) {
			value = newValue;
			AppPreferences.firePropertyChange(name, Double.valueOf(oldValue), Double.valueOf(newValue));
		}
	}
}
 
Example 42
Project: incubator-netbeans   File: ReindenterTest.java   Source Code and License 5 votes vote down vote up
public void testLineIndentationBeforeHalfIndentedForBlock() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("otherBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performLineIndentationTest("package t;\npublic class T {\n    public void op() {\n        for (;;)\n|            {\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        for (;;)\n          {\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
Example 43
Project: incubator-netbeans   File: ExtFormatter.java   Source Code and License 5 votes vote down vote up
public ExtFormatter(Class kitClass) {
    super(kitClass);

    initFormatLayers();

    this.mimeType = BaseKit.getKit(kitClass).getContentType();
    prefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, prefsListener, prefs));
}
 
Example 44
Project: intellij-deps-ini4j   File: ReadPrimitiveSample.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) throws Exception
{
    String filename = (args.length > 0) ? args[0] : FILENAME;
    Preferences prefs = new IniPreferences(new Ini(new File(filename)));
    Preferences dopey = prefs.node("dopey");
    int age = dopey.getInt("age", 0);
    float weight = dopey.getFloat("weight", 0);

    System.out.println("dopey/age: " + age);
    System.out.println("dopey/weight: " + weight);
}
 
Example 45
Project: incubator-netbeans   File: OutputOptions.java   Source Code and License 5 votes vote down vote up
/**
 * Save font settings. Save allways, changing L&F shouldn't affect font
 * settings.
 */
private void saveFontsTo(Preferences preferences) {
    preferences.putInt(PREFIX + PROP_FONT_SIZE, getFont().getSize());
    preferences.putInt(PREFIX + PROP_FONT_STYLE, getFont().getStyle());
    preferences.putInt(PREFIX + PROP_FONT_SIZE_WRAP,
            getFontForWrappedMode().getSize());
    preferences.put(PREFIX + PROP_FONT_FAMILY, getFont().getFamily());
    preferences.put(PREFIX + PROP_STYLE_LINK, getLinkStyle().name());
}
 
Example 46
Project: incubator-netbeans   File: ConnectionManager.java   Source Code and License 5 votes vote down vote up
void storeRecentConnectionsList() {
    Preferences prefs = NbPreferences.forModule(ConnectionManager.class);
    synchronized (recentConnections) {
        for (int i = 0; i < recentConnections.size(); i++) {
            prefs.put(getConnectoinsHistoryKey(i), ExecutionEnvironmentFactory.toUniqueID(recentConnections.get(i)));
        }
    }
}
 
Example 47
Project: incubator-netbeans   File: MetadataProjectHudsonProvider.java   Source Code and License 5 votes vote down vote up
public boolean recordAssociation(Project project, Association assoc) {
    Preferences prefs = ProjectUtils.getPreferences(project, MetadataProjectHudsonProvider.class, true);
    if (assoc != null) {
        prefs.put(KEY, assoc.toString());
    } else {
        prefs.remove(KEY);
    }
    return true;
}
 
Example 48
Project: incubator-netbeans   File: ResizeOptions.java   Source Code and License 5 votes vote down vote up
private void save(Preferences prefs, ResizeOption option) {
    prefs.put("displayName", option.getDisplayName()); // NOI18N
    prefs.putInt("width", option.getWidth()); // NOI18N
    prefs.putInt("height", option.getHeight()); // NOI18N
    prefs.putBoolean("toolbar", option.isShowInToolbar()); // NOI18N
    prefs.putBoolean("default", option.isDefault()); // NOI18N
    prefs.put("type", option.getType().name()); // NOI18N
}
 
Example 49
Project: intellij-deps-ini4j   File: IniPreferencesFactoryTest.java   Source Code and License 5 votes vote down vote up
@Test public void testUserRoot() throws Exception
{
    Preferences prefs = Preferences.userRoot();

    assertNotNull(prefs);
    assertEquals(IniPreferences.class, prefs.getClass());
    assertSame(prefs, Preferences.userRoot());
}
 
Example 50
Project: jaer   File: RecentFiles.java   Source Code and License 5 votes vote down vote up
/** Creates a new instance of RecentFiles
     * @param prefs the Preferences node to store recent files in
     * @param fileMenu the File mane to load with recent files. The menu is added just before the end, presumed to be Exit
     * @param listener the MenuListener to call when one of the items is selected
     */
    public RecentFiles(Preferences prefs, JMenu fileMenu, ActionListener listener) {
        this.prefs=prefs;
        this.fileMenu=fileMenu;
        this.listener=listener;
        getPrefs();
        fileMenuList=new ArrayList<JMenuItem>(MAX_FILES);
//        folderMenuList=new ArrayList<JMenuItem>(MAX_FOLDERS);
        
        fileMenu.insertSeparator(fileMenu.getItemCount()-2);
        fileMenu.insertSeparator(fileMenu.getItemCount()-2); // we put stuff after this
        buildMenu();
    }
 
Example 51
Project: incubator-netbeans   File: DocumentationSettings.java   Source Code and License 4 votes vote down vote up
/** Getter for property idxSearchSplit.
 *@return Value of property idxSearchSplit.
 */
public int getIdxSearchSplit() {
    Preferences prefs = getPreferences();
    return prefs.getInt(PROP_SEARCH_SPLIT, 50);
}
 
Example 52
Project: Tarski   File: TestXml.java   Source Code and License 4 votes vote down vote up
/**
 * Reads the current value of the Java preference object (if it's not set, then return DEFAULT).
 */
private static Verbosity get() {
  return parse(Preferences.userNodeForPackage(Util.class).get("Verbosity", ""));
}
 
Example 53
Project: incubator-netbeans   File: RepositoryRegistry.java   Source Code and License 4 votes vote down vote up
private static Preferences getBugzillaPreferences() {
    return NbPreferences.root().node("org/netbeans/modules/bugzilla"); // NOI18N
}
 
Example 54
Project: incubator-netbeans   File: HintsSettings.java   Source Code and License 4 votes vote down vote up
/** For current profile
 */ 
public static boolean isShowInTaskList(GsfHintsManager manager, UserConfigurableRule hint ) {
    Preferences p = getPreferences(manager, hint, HintsSettings.getCurrentProfileId());
    return isShowInTaskList(hint, p);
}
 
Example 55
Project: incubator-netbeans   File: ProxyPreferencesImplTest.java   Source Code and License 4 votes vote down vote up
/**
 * Checks that puts to the direct store is refired
 */
public void testSeeStoredEvents() throws Exception {
    Preferences stored = new MapPreferences();
    Preferences inherited = new MapPreferences();
    
    inherited.putInt("intValue", 100);
    stored.putInt("intValue", 2);
    stored.putBoolean("toBeRemoved", Boolean.TRUE);

    MemoryPreferences mem = MemoryPreferences.getWithInherited(this, inherited, stored);
    Preferences test = mem.getPreferences();
    
    PL pl = new PL();
    test.addPreferenceChangeListener(pl);
    
    // add
    pl.arm();
    stored.put("newValue", "baa");
    pl.waitEvent();
    assertEquals(1, pl.changeCount);
    assertEquals("newValue", pl.key);
    assertEquals("baa", pl.value);
    
    // change
    pl.arm();
    stored.putInt("intValue", 3);
    pl.waitEvent();
    assertEquals(2, pl.changeCount);
    assertEquals("intValue", pl.key);
    assertEquals("3", pl.value);
    
    // remove not inherited
    pl.arm();
    stored.remove("newValue");
    pl.waitEvent();
    assertEquals(3, pl.changeCount);
    assertEquals("newValue", pl.key);
    assertEquals(null, pl.value);
    
    // remove inherited
    pl.arm();
    stored.remove("intValue");
    pl.waitEvent();
    assertEquals(4, pl.changeCount);
    assertEquals("intValue", pl.key);
    assertEquals("100", pl.value);
}
 
Example 56
Project: Conan   File: MainController.java   Source Code and License 4 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
    Preferences prefs = Preferences.userRoot().node("General"); // Inställningar i noden "General"

    if (prefs.getBoolean("verify", true)) {
        verification.setSelected(true);
    }
    if (prefs.getBoolean("generate", true)) {
        generation.setSelected(true);
    }
    verificationToggle(null);
    generationToggle(null);
    tabPane.getSelectionModel().selectedItemProperty().addListener((ov, oldTab, newTab) -> {
        if (newTab instanceof ViewTab) {
            currentTab = (ViewTab) newTab;
            if (getCurrentView() != null)
                new Thread(new Task<Void>() {
                    @Override
                    public Void call() throws Exception {
                        Thread.sleep(100); // Only reliable way is to wait for all nodes to be created
                        return null;
                    }

                    @Override
                    public void succeeded() {
                        View view = getCurrentView();
                        if (view != null)
                            view.focusFirst();
                    }

                }).start();
        } else {
            currentTab = null;
        }
    });
    if (prefs.getBoolean("showWelcome", true)) { // Om showWelcome-paret ej existerar, returnera true
        showWelcome(null);
    } else {
        newProof(null);
    }
    createTooltip();
}
 
Example 57
Project: openjdk-jdk10   File: JShellToolBuilder.java   Source Code and License 4 votes vote down vote up
PreferencesStorage(Preferences p) {
    this.p = p;
}
 
Example 58
Project: incubator-netbeans   File: OnSaveTabSelector.java   Source Code and License 4 votes vote down vote up
public Preferences getPreferences(String mimeType) {
    return preferencesFactory.getPreferences(mimeType);
}
 
Example 59
Project: incubator-netbeans   File: RemoveUnusedImportFix.java   Source Code and License 4 votes vote down vote up
private static synchronized Preferences getPreferences() {
    if( preferences == null ) {
        preferences = NbPreferences.forModule(RemoveUnusedImportFix.class);
    }
    return preferences;
}
 
Example 60
Project: incubator-netbeans   File: RecentFiles.java   Source Code and License 4 votes vote down vote up
static Preferences getPrefs() {
    if (prefs == null) {
        prefs = NbPreferences.forModule(RecentFiles.class).node(PREFS_NODE);
    }
    return prefs;
}