当前位置: 首页>>代码示例>>Java>>正文


Java Preferences.remove方法代码示例

本文整理汇总了Java中java.util.prefs.Preferences.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.remove方法的具体用法?Java Preferences.remove怎么用?Java Preferences.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.prefs.Preferences的用法示例。


在下文中一共展示了Preferences.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void save() {
    Preferences prefs = NbPreferences.forModule(RunAnalysisPanel.class).node("RunAnalysisPanel");
    
    prefs.putBoolean("configurationsSelected", configurationsSelected);
    if (selectedAnalyzer != null)
        prefs.put("selectedAnalyzer", selectedAnalyzer);
    else
        prefs.remove("selectedAnalyzer");
    if (selectedConfiguration != null)
        prefs.put("selectedConfiguration", selectedConfiguration);
    else
        prefs.remove("selectedConfiguration");
    if (selectedInspection != null)
        prefs.put("selectedInspection", selectedInspection);
    else
        prefs.remove("selectedInspection");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RunAnalysisPanel.java

示例2: testSeeInheritedThroughRemoves

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Asserts that if a value is remove()d during editing, the inherited value
 * will be seen through. Also checks that the Preferences key is actually
 * deleted on flush() and the inherited preferences is not altered.
 */
public void testSeeInheritedThroughRemoves() throws Exception {
    Preferences stored = new MapPreferences();
    Preferences inherited = new MapPreferences();

    stored.put("key", "value");
    inherited.put("key", "parentValue");
    
    MemoryPreferences mem = MemoryPreferences.getWithInherited(this, inherited, stored);
    Preferences test = mem.getPreferences();

    assertEquals("Does not see local value", "value", test.get("key", null));
    test.remove("key");
    
    assertEquals("Stored value changed prematurely", "value", stored.get("key", null));
    assertEquals("Inherited not seen", "parentValue", test.get("key", null));
    
    test.flush();
    assertNull("Stored value not erased", stored.get("key", null));
    assertEquals("Inherited changed", "parentValue", test.get("key", null));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProxyPreferencesImplTest.java

示例3: put

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Stores a List of Strings into Preferences node under the given key.
 *
 * @param prefs storage
 * @param key key of the String array
 * @param value List of Strings to write (order will be preserved)
 */
public static void put(Preferences prefs, String key, List<String> value) {
    try {
        String[] keys = prefs.keys();
        for (int i = 0; i < keys.length; i++) {
            String k = keys[i];
            if (k != null && k.startsWith(key + ".")) {
                prefs.remove(k);
            }
        }
        int idx = 0;
        for (String s : value) {
            prefs.put(key + "." + idx++, s);
        }
    } catch (BackingStoreException ex) {
        Logger.getLogger(Utils.class.getName()).log(Level.INFO, null, ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Utils.java

示例4: testNewLineIndentationBeforeHalfIndentedNewClassTreeBody

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testNewLineIndentationBeforeHalfIndentedNewClassTreeBody() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("classDeclBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n    public void op() {\n        Runnable r = new Runnable()| {\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        Runnable r = new Runnable()\n          {\n    }\n}\n");
    } finally {
        preferences.remove("classDeclBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例5: removeAllKidsAndKeys

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void removeAllKidsAndKeys(Preferences prefs) throws BackingStoreException {
    for(String kid : prefs.childrenNames()) {
        prefs.node(kid).removeNode();
    }
    for(String key : prefs.keys()) {
        prefs.remove(key);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ProxyPreferencesImplTest.java

示例6: testLineIndentationInsideMultilineComment

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testLineIndentationInsideMultilineComment() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performLineIndentationTest("package t;\npublic class T {\n    /*\n|\n     */\n    public void op() {\n    }\n}\n",
                "package t;\npublic class T {\n    /*\n     * \n     */\n    public void op() {\n    }\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例7: testLineIndentationBeforeHalfIndentedElseBlock

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testLineIndentationBeforeHalfIndentedElseBlock() 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        if (true) {\n        } else\n|            {\n        }\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        if (true) {\n        } else\n          {\n        }\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例8: testLineIndentationAtMultilineCommentStart

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testLineIndentationAtMultilineCommentStart() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performLineIndentationTest("package t;\npublic class T {\n    /*\n|\n    public void op() {\n    }\n}\n",
                "package t;\npublic class T {\n    /*\n     * \n    public void op() {\n    }\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例9: testLineIndentationBeforeHalfIndentedFinallyBlock

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testLineIndentationBeforeHalfIndentedFinallyBlock() 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        try\n          {\n          }\n        finally\n|{\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        try\n          {\n          }\n        finally\n          {\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例10: testRemove

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testRemove() {
    testPut();
    Preferences pref = getPreferencesNode();
    assertEquals("value1",pref.get("key1", null));
    pref.remove("key1");
    assertNull(pref.get("key1", null));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TestPreferences.java

示例11: testNewLineIndentationInsideMultilineComment

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testNewLineIndentationInsideMultilineComment() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n    /*|\n     */\n    public void op() {\n    }\n}\n",
                "package t;\npublic class T {\n    /*\n     * \n     */\n    public void op() {\n    }\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例12: testNewLineIndentationBeforeHalfIndentedStaticBlock

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testNewLineIndentationBeforeHalfIndentedStaticBlock() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("otherBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n    static| {\n    }\n}\n",
                "package t;\npublic class T {\n    static\n      {\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例13: testLineIndentationBeforeHalfIndentedNewClassTreeBody

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testLineIndentationBeforeHalfIndentedNewClassTreeBody() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("classDeclBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performLineIndentationTest("package t;\npublic class T {\n    public void op() {\n        Runnable r = new Runnable()\n|                {\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        Runnable r = new Runnable()\n          {\n    }\n}\n");
    } finally {
        preferences.remove("classDeclBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例14: testNewLineIndentationBeforeHalfIndentedArrayInit

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testNewLineIndentationBeforeHalfIndentedArrayInit() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.put("otherBracePlacement", CodeStyle.BracePlacement.NEW_LINE_HALF_INDENTED.name());
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n    public void op() {\n        int[] arr =| {\n    }\n}\n",
                "package t;\npublic class T {\n    public void op() {\n        int[] arr =\n          {\n    }\n}\n");
    } finally {
        preferences.remove("otherBracePlacement");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ReindenterTest.java

示例15: testNode

import java.util.prefs.Preferences; //导入方法依赖的package包/类
@Test
public void testNode() {
    Preferences userRoot = factory.remoteUserRoot("brian");
    log.debug("userRoot = " + userRoot.absolutePath());
    userRoot.put("trash", "foo");
    String s0 = userRoot.get("trash", "bar");
    assertTrue("Returned value was not what we expected", s0.equals("foo"));
    userRoot.put("trash", "bar");
    String s1 = userRoot.get("trash", "bar");
    assertTrue("Returned value was not what we expected", s1.equals("bar"));
    userRoot.remove("trash");

}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:14,代码来源:WebPreferencesTest.java


注:本文中的java.util.prefs.Preferences.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。