本文整理汇总了Java中java.util.prefs.Preferences.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.clear方法的具体用法?Java Preferences.clear怎么用?Java Preferences.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.prefs.Preferences
的用法示例。
在下文中一共展示了Preferences.clear方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void save() throws IOException {
try {
Preferences prefs = NbPreferences.forModule(FilterRepository.class);
prefs = prefs.node("Filters"); //NOI18N
prefs.clear();
prefs.putBoolean("firstTimeStart", false); //NOI18N
prefs.putBoolean("firstTimeStartWithIssue", false); //NOI18N
prefs.putInt("count", filters.size()); //NOI18N
prefs.putInt("active", active); //NOI18N
for (int i = 0; i < filters.size(); i++) {
NotificationFilter filter = filters.get(i);
filter.save(prefs, "Filter_" + i); //NOI18N
}
} catch (BackingStoreException bsE) {
throw new IOException("Cannot save filter repository", bsE);
}
}
示例2: save
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void save() throws IOException {
try {
Preferences prefs = NbPreferences.forModule( FilterRepository.class );
prefs = prefs.node( "Filters" ); //NOI18N
prefs.clear();
prefs.putBoolean( "firstTimeStart", false ); //NOI18N
prefs.putBoolean( "firstTimeStartWithIssue", false ); //NOI18N
prefs.putInt( "count", filters.size() ); //NOI18N
prefs.putInt( "active", active ); //NOI18N
for( int i=0; i<filters.size(); i++ ) {
TaskFilter filter = filters.get( i );
filter.save( prefs, "Filter_" + i ); //NOI18N
}
} catch( BackingStoreException bsE ) {
IOException ioE = new IOException( "Cannot save filter repository" ); //NOI18N
ioE.initCause( bsE );
throw ioE;
}
}
示例3: storeUpdateElements
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static void storeUpdateElements (OperationType operationType, Collection<UpdateElement> elements) {
Preferences p = getPreferences (operationType);
try {
if (p.keys ().length > 0) {
p.clear ();
}
} catch (BackingStoreException ex) {
Logger.getLogger (LazyInstallUnitWizardIterator.class.getName ()).log (Level.WARNING, ex.getLocalizedMessage (), ex);
}
if (elements == null) {
return ;
}
for (UpdateElement el : elements) {
p.put (el.getCodeName (), toString (el));
}
}
示例4: storeLazyUnits
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static void storeLazyUnits (OperationType operationType, Collection<LazyUnit> units) {
Preferences p = getPreferences (operationType);
try {
if (p.keys ().length > 0) {
p.clear ();
}
} catch (BackingStoreException ex) {
Logger.getLogger (LazyInstallUnitWizardIterator.class.getName ()).log (Level.WARNING, ex.getLocalizedMessage (), ex);
}
if (units == null) {
return ;
}
for (LazyUnit u : units) {
p.put (u.getCodeName (), u.toString ());
}
}
示例5: promptToDelete
import java.util.prefs.Preferences; //导入方法依赖的package包/类
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;
}
示例6: storeFileNames
import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void storeFileNames() {
Preferences p = Preferences.userNodeForPackage(this.getClass());
try {
p.clear();
p.flush();
p = Preferences.userNodeForPackage(this.getClass());
int itemCount = projectInfotable.getItems().size();
int selected = projectInfotable.getSelectionModel().getSelectedIndex();
if (selected == -1)
selected = 0;
ProjectInfo pi = projectInfotable.getItems().get(selected);
p.put("dirName0", pi.getFolder());
for (int i = 0, j = 1; i < itemCount; i++) {
if (i != selected) {
p.put("dirName" + j++, projectInfotable.getItems().get(i).getFolder());
}
}
} catch (BackingStoreException e) {
return;
}
}
示例7: getPrefs
import java.util.prefs.Preferences; //导入方法依赖的package包/类
private static Preferences getPrefs(boolean shouldClear) {
if (prefs == null) {
synchronized (AppPreferences.class) {
if (prefs == null) {
Preferences p = Preferences.userNodeForPackage(Main.class);
if (shouldClear) {
try {
p.clear();
} catch (BackingStoreException e) {
}
}
myListener = new MyListener();
p.addPreferenceChangeListener(myListener);
prefs = p;
setTemplateFile(convertFile(p.get(TEMPLATE_FILE, null)));
setTemplateType(p.getInt(TEMPLATE_TYPE, TEMPLATE_PLAIN));
}
}
}
return prefs;
}
示例8: saveList
import java.util.prefs.Preferences; //导入方法依赖的package包/类
private static void saveList(Preferences parent, List<?> list) throws BackingStoreException {
parent.clear();
for (int i = 0; i < list.size(); i++) {
parent.put(Integer.toString(i), list.get(i).toString());
}
}
示例9: testClear
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testClear() throws Exception {
testKeys();
Preferences pref = getPreferencesNode();
pref.clear();
assertEquals(0,pref.keys().length);
assertNull(pref.get("key1", null));
assertNull(pref.get("key2", null));
}
示例10: dontRemind
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void dontRemind () {
Preferences p = NbPreferences.forModule (Installer.class);
try {
p.clear ();
} catch (BackingStoreException ex) {
Exceptions.printStackTrace (ex);
}
}
示例11: clear
import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static void clear() {
Preferences p = getPrefs(true);
try {
p.clear();
} catch (BackingStoreException e) {
}
}