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


Java Preferences.clear方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:FilterRepository.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:FilterRepository.java

示例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));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:LazyInstallUnitWizardIterator.java

示例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 ());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:LazyInstallUnitWizardIterator.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:FallbackProvider.java

示例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;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:22,代码来源:ProjectSelection.java

示例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;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:23,代码来源:AppPreferences.java

示例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());
	}
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:8,代码来源:ProjectConfig.java

示例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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TestPreferences.java

示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ImportManager.java

示例11: clear

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static void clear() {
	Preferences p = getPrefs(true);
	try {
		p.clear();
	} catch (BackingStoreException e) {
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:8,代码来源:AppPreferences.java


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