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


Java Preferences.userNodeForPackage方法代码示例

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


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

示例1: removeFromPreferences

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void removeFromPreferences(ProjectInfo selectedItem) {
    Preferences p = Preferences.userNodeForPackage(this.getClass());
    String[] keys;
    try {
        keys = p.keys();
        for (int i = 0; i < keys.length; i++) {
            String key = keys[i];
            String fName = p.get(key, null);
            if (fName.equals(selectedItem.getFolder())) {
                p.remove(key);
                break;
            }
        }
    } catch (BackingStoreException e) {
        return;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:ProjectSelection.java

示例2: 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

示例3: saveConfig

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void saveConfig() {
    // Registry path on Windows Xp:
    // HKEY_CURRENT_USER/Software/JavaSoft/Prefs/us/deathmarine/luyten
    try {
        Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class);

        prefs.putBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks());
        prefs.putBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports());
        prefs.putBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers());
        prefs.putBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes());
        prefs.putBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID, decompilerSettings.getForceExplicitTypeArguments());
        prefs.putBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts());
        prefs.putBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics());
        prefs.putBoolean(UNICODE_REPLACE_ENABLED_ID, decompilerSettings.isUnicodeOutputEnabled());
        prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName());

        saveWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX, mainWindowPosition);
        saveWindowPosition(prefs, FIND_WINDOW_ID_PREFIX, findWindowPosition);
        saveLuytenPreferences(prefs);
    } catch (Exception e) {
        Luyten.showExceptionDialog("Exception!", e);
    }
}
 
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:24,代码来源:ConfigSaver.java

示例4: testNotPersistentPreferences

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void testNotPersistentPreferences() throws Exception {
    Preferences pref = Preferences.userNodeForPackage(getClass());
    assertNotNull(pref);
    pref.put(getName(), "value");
    assertEquals("value", pref.get(getName(), null));
    pref.sync();
    assertEquals(null, pref.get(getName(), null));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:NbTestCasePreferencesTest.java

示例5: main

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Preferences prefs = Preferences.userNodeForPackage(CheckUserPrefFirst.class);
    String result = prefs.get("Check", null);
    if ((result == null) || !(result.equals("Success")))
        throw new RuntimeException("User pref not stored!");
    prefs.remove("Check");
    prefs.flush();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:CheckUserPrefLater.java

示例6: getPortNumbers

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 *
 * @return Pair with Sharkopoda control port (key) and Framecapture port (value)
 */
public static Pair<Integer, Integer> getPortNumbers() {
    Preferences prefs = Preferences.userNodeForPackage(SharktopodaSettingsPaneController.class);
    int dSharkPort = Initializer.getConfig().getInt("sharktopoda.defaults.control.port");
    int dFgPort = Initializer.getConfig().getInt("sharktopoda.defaults.framegrab.port");

    try {
        int cport = prefs.getInt(CONTROL_PORT_KEY, dSharkPort);
        int fport = prefs.getInt(FRAMEGRAB_PORT_KEY, dFgPort);
        return new Pair<>(cport, fport);
    }
    catch (Exception e) {
        return null;
    }
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:19,代码来源:SharktopodaSettingsPaneController.java

示例7: setLogLevel

import java.util.prefs.Preferences; //导入方法依赖的package包/类
@Override public void setLogLevel(int level) {
    Preferences p = Preferences.userNodeForPackage(LogViewLogger.class);
    p.putInt("loglevel", level);
    try {
        p.flush();
    } catch (BackingStoreException e) {
    }
    this.level = level;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:LogViewLogger.java

示例8: ParameterContainer

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public ParameterContainer(String name, Preferences prefs) {
//	public ParameterContainer(String name, Preferences parentPrefs, String nodeName) {
		this.name = name;
		this.prefs = prefs;
		if (prefs == null) {
			this.prefs = Preferences.userNodeForPackage(this.getClass());
		}
//		this.prefs = parentPrefs.node(nodeName);
		addExcludedProperty("controlsExpanded");
		support.addPropertyChangeListener(this);
		discoverParameters();
	}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:ParameterContainer.java

示例9: loadConfig

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Do not load, get the loaded instance
 */
private void loadConfig() {
	decompilerSettings = new DecompilerSettings();
	if (decompilerSettings.getJavaFormattingOptions() == null) {
		decompilerSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault());
	}
	luytenPreferences = new LuytenPreferences();
	mainWindowPosition = new WindowPosition();
	findWindowPosition = new WindowPosition();
	try {
		Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class);
		if (!prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())
				.equals(decompilerSettings.getLanguage().getName()))
			prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName());

		decompilerSettings.setFlattenSwitchBlocks(
				prefs.getBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks()));
		decompilerSettings.setForceExplicitImports(
				prefs.getBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports()));
		decompilerSettings.setShowSyntheticMembers(
				prefs.getBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers()));
		decompilerSettings.setExcludeNestedTypes(
				prefs.getBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes()));
		decompilerSettings.setForceExplicitTypeArguments(prefs.getBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID,
				decompilerSettings.getForceExplicitTypeArguments()));
		decompilerSettings.setRetainRedundantCasts(
				prefs.getBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts()));
		decompilerSettings.setIncludeErrorDiagnostics(
				prefs.getBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics()));
		decompilerSettings.setLanguage(
				findLanguageByName(prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())));
		decompilerSettings.setUnicodeOutputEnabled(prefs.getBoolean(UNICODE_REPLACE_ENABLED_ID, false));

		mainWindowPosition = loadWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX);
		findWindowPosition = loadWindowPosition(prefs, FIND_WINDOW_ID_PREFIX);
		luytenPreferences = loadLuytenPreferences(prefs);
	} catch (Exception e) {
		Luyten.showExceptionDialog("Exception!", e);
	}
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:43,代码来源:ConfigSaver.java

示例10: createFromUserPreferences

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Charge les paramètres depuis les préférences utilisateur.
 * @return Parameters
 * @throws BackingStoreException e
 */
public static Parameters createFromUserPreferences() throws BackingStoreException {
	final Properties properties = new Properties();
	final Preferences prefs = Preferences.userNodeForPackage(Parameters.class);
	for (final String key : prefs.keys()) {
		final String value = prefs.get(key, null);
		if (value != null && !value.isEmpty()) {
			properties.put(key, value);
		}
	}
	return new Parameters(properties);
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:17,代码来源:Parameters.java

示例11: SiLabsC8051F320_LibUsb_PAER

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public SiLabsC8051F320_LibUsb_PAER(Device dev) {
    LibUsb.setDebug(null, 1);
    this.retina = dev;
    this.prefs = Preferences.userNodeForPackage(this.getClass());
    this.aeReader = null;


}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:SiLabsC8051F320_LibUsb_PAER.java

示例12: start

import java.util.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception
{
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.getIcons().add(new Image("/com/matthieu42/steamtradertools/bundles/images/Icon_STTBluepng.png"));
    Preferences prefs = Preferences.userNodeForPackage(com.matthieu42.steamtradertools.model.Main.class);
    String language = prefs.get(PreferencesKeys.LANGUAGE.toString(),Locale.ENGLISH.getDisplayLanguage());
    Locale locale;
    if(language.equals(Locale.FRENCH.getDisplayLanguage()))
    {
        locale = Locale.FRENCH;
    }
    else
        locale = Locale.ENGLISH;
    I18n.setLocale(locale);
    I18n.setBundle("com/matthieu42/steamtradertools/bundles/lang",locale);
    final AllAppList allAppList = new AllAppList();
    final UserAppList userAppList = new UserAppList();

    File steamAppList = new File("steamAppList.xml");
    if (!steamAppList.exists())
    {
        FXMLLoader splashLoader = new FXMLLoader(getClass().getResource("/com/matthieu42/steamtradertools/view/loadview.fxml"),I18n.getResourceBundle());
        AnchorPane pane = splashLoader.load();
        primaryStage.setScene(new Scene(pane));
        primaryStage.show();
        Task<Void> syncApp = allAppList.init();
        syncApp.setOnSucceeded(t ->
        {
            allAppList.saveToXml();
            continueLaunch(allAppList,userAppList,primaryStage);
        });

        syncApp.setOnFailed(t ->
        {
            return;
        });
        new Thread(syncApp).start();
    } else
    {
        allAppList.loadFromXml();
        continueLaunch(allAppList,userAppList,primaryStage);
    }
}
 
开发者ID:Matthieu42,项目名称:Steam-trader-tools,代码行数:45,代码来源:Main.java

示例13: loadConfig

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Do not load, get the loaded instance
 */
private void loadConfig() {
    decompilerSettings = new DecompilerSettings();
    if (decompilerSettings.getJavaFormattingOptions() == null) {
        decompilerSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault());
    }
    luytenPreferences = new LuytenPreferences();
    mainWindowPosition = new WindowPosition();
    findWindowPosition = new WindowPosition();
    try {
        Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class);
        if (!prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())
                .equals(decompilerSettings.getLanguage().getName()))
            prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName());

        decompilerSettings.setFlattenSwitchBlocks(
                prefs.getBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks()));
        decompilerSettings.setForceExplicitImports(
                prefs.getBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports()));
        decompilerSettings.setShowSyntheticMembers(
                prefs.getBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers()));
        decompilerSettings.setExcludeNestedTypes(
                prefs.getBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes()));
        decompilerSettings.setForceExplicitTypeArguments(prefs.getBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID,
                decompilerSettings.getForceExplicitTypeArguments()));
        decompilerSettings.setRetainRedundantCasts(
                prefs.getBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts()));
        decompilerSettings.setIncludeErrorDiagnostics(
                prefs.getBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics()));
        decompilerSettings.setLanguage(
                findLanguageByName(prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())));
        decompilerSettings.setUnicodeOutputEnabled(prefs.getBoolean(UNICODE_REPLACE_ENABLED_ID, false));

        mainWindowPosition = loadWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX);
        findWindowPosition = loadWindowPosition(prefs, FIND_WINDOW_ID_PREFIX);
        luytenPreferences = loadLuytenPreferences(prefs);
    } catch (Exception e) {
        Luyten.showExceptionDialog("Exception!", e);
    }
}
 
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:43,代码来源:ConfigSaver.java

示例14: loadDividerPositions

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void loadDividerPositions(String name, SplitPane pane) {
    Preferences p0 = Preferences.userNodeForPackage(getClass());
    Preferences p1 = p0.node(name);
    double[] positions = pane.getDividerPositions();
    for (int i = 0; i < positions.length; i++) {
        try {
            double v = p1.getDouble(i + "", positions[i]);
            pane.setDividerPosition(i, v);
        }
        catch (Exception e) {
            // TODO log it
        }
    }
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:15,代码来源:ControlsPaneController.java

示例15: save

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Save these settings.
 */
@FromAnyThread
public synchronized void save() {

    final Preferences prefs = Preferences.userNodeForPackage(Editor.class);
    prefs.putInt(PREF_GRAPHIC_ANISOTROPY, getAnisotropy());
    prefs.putBoolean(PREF_GRAPHIC_FXAA, isFXAA());
    prefs.putBoolean(PREF_GRAPHIC_GAMA_CORRECTION, isGammaCorrection());
    prefs.putBoolean(PREF_GRAPHIC_STOP_RENDER_ON_LOST_FOCUS, isStopRenderOnLostFocus());
    prefs.putBoolean(PREF_GRAPHIC_TONEMAP_FILTER, isToneMapFilter());
    prefs.putInt(PREF_SCREEN_HEIGHT, getScreenHeight());
    prefs.putInt(PREF_SCREEN_WIDTH, getScreenWidth());
    prefs.putBoolean(PREF_SCREEN_MAXIMIZED, isMaximized());
    prefs.putInt(PREF_OTHER_GLOBAL_LEFT_TOOL_WIDTH, getGlobalLeftToolWidth());
    prefs.putBoolean(PREF_OTHER_GLOBAL_LEFT_TOOL_COLLAPSED, isGlobalLeftToolCollapsed());
    prefs.putInt(PREF_OTHER_GLOBAL_BOTTOM_TOOL_WIDTH, getGlobalBottomToolHeight());
    prefs.putBoolean(PREF_OTHER_GLOBAL_BOTTOM_TOOL_COLLAPSED, isGlobalBottomToolCollapsed());
    prefs.putBoolean(PREF_OTHER_ANALYTICS, isAnalytics());
    prefs.putBoolean(PREF_OTHER_NATIVE_FILE_CHOOSER, isNativeFileChooser());
    prefs.putInt(PREF_GRAPHIC_FRAME_RATE, getFrameRate());
    prefs.putInt(PREF_GRAPHIC_CAMERA_ANGLE, getCameraAngle());
    prefs.putBoolean(PREF_EDITING_AUTO_TANGENT_GENERATING, isAutoTangentGenerating());
    prefs.putBoolean(PREF_EDITING_DEFAULT_USE_FLIPPED_TEXTURE, isDefaultUseFlippedTexture());
    prefs.putBoolean(PREF_EDITING_CAMERA_LAMP_ENABLED, isDefaultEditorCameraEnabled());
    prefs.putBoolean(PREF_OTHER_ANALYTICS_QUESTION, isAnalyticsQuestion());
    prefs.putInt(PREF_OTHER_THEME, getTheme().ordinal());
    prefs.putInt(PREF_GRAPHIC_OPEN_GL, getOpenGLVersion().ordinal());

    final Vector3f whitePoint = getToneMapFilterWhitePoint();

    prefs.put(PREF_GRAPHIC_TONEMAP_FILTER_WHITE_POINT, whitePoint.getX() + "," + whitePoint.getY() + "," + whitePoint.getZ());

    if (currentAsset != null && !Files.exists(currentAsset)) {
        currentAsset = null;
    }

    if (librariesPath != null && !Files.exists(librariesPath)) {
        librariesPath = null;
    }

    if (currentAsset != null) {
        prefs.put(PREF_ASSET_CURRENT_ASSET, currentAsset.toUri().toString());
    } else {
        prefs.remove(PREF_ASSET_CURRENT_ASSET);
    }

    if (librariesPath != null) {
        prefs.put(PREF_OTHER_LIBRARIES_FOLDER, librariesPath.toUri().toString());
    } else {
        prefs.remove(PREF_OTHER_LIBRARIES_FOLDER);
    }

    if (classesPath != null) {
        prefs.put(PREF_OTHER_CLASSES_FOLDER, classesPath.toUri().toString());
    } else {
        prefs.remove(PREF_OTHER_CLASSES_FOLDER);
    }

    if (additionalEnvs != null) {
        prefs.put(PREF_OTHER_ADDITIONAL_ENVS, additionalEnvs.toUri().toString());
    } else {
        prefs.remove(PREF_OTHER_ADDITIONAL_ENVS);
    }

    final List<String> lastOpenedAssets = getLastOpenedAssets();

    prefs.putByteArray(PREF_ASSET_LAST_OPENED_ASSETS, EditorUtil.serialize((Serializable) lastOpenedAssets));
    try {
        prefs.flush();
    } catch (final BackingStoreException e) {
        throw new RuntimeException(e);
    }

    System.setProperty("jfx.frame.transfer.camera.angle", String.valueOf(getCameraAngle()));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:78,代码来源:EditorConfig.java


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