當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。