本文整理匯總了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");
}
示例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));
}
示例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);
}
}
示例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");
}
}
示例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);
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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));
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}