博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Eclipse Preference Scope
阅读量:3534 次
发布时间:2019-05-20

本文共 2277 字,大约阅读时间需要 7 分钟。

Eclipse Preference Scope

INSTANCE - The instance scope can also be thought of as "workspace". That is, the preferences which are stored in this scope are stored per workspace, or per running instance of Eclipse. This scope corresponds to the default location of preferences in Eclipse 2.1. The instance area is derived from the location returned by org.eclipse.core.runtime.Platform#getInstanceLocation(). Preferences stored in this scope will not be available to other running instances of Eclipse.

CONFIGURATION - The configuration scope is used to store preferences on a per configuration level. Being able store preferences per configuration means that all workspaces share the same preferences. For instance, if you are an Eclipse developer and you have a single Eclipse install but you have multiple workspaces for different projects/branches that you are working on, the preferences stored in the configuration scope will be shared between these workspaces. The configuration area is derived from the location returned by org.eclipse.core.runtime.Platform#getConfigurationLocation().
DEFAULT - The default preference scope was initially created to provide a backwards compatibility story for the plug-in customization code in Eclipse 2.1. Preferences stored in the default scope are not persisted to disk and are a part of the plug-in customization story.
PROJECT - There was a request for per project preferences so the project scope handles this. Preferences which are stored in this scope are shared stored in the project content area and are therefore automatically shared with the repository. This enables items like java compiler settings to be shared between team members working on the same project.
INSTANCE and CONFIGURATION are used in most situations.
Store data in Preference:
INSTANCE
...
Preferences preferences = new InstanceScope().getNode("foo.bar.MyPlugin");
preferences.put("key", "value");
try {
       preferences.flush();
 } catch (BackingStoreException e) {
       e.printStackTrace();
 }
...
CONFIGURATION
Preferences preferences = new ConfigurationScope().getNode("foo.bar.MyPlugin");
preferences.put("key", "value");
try {
       preferences.flush();
 } catch (BackingStoreException e) {
       e.printStackTrace();
 }
...
Load data in Preference:
preferences.get("key", "");

转载地址:http://rnmhj.baihongyu.com/

你可能感兴趣的文章
code刷题
查看>>
左神进阶2窗口
查看>>
dubbo入门
查看>>
http 错误类型
查看>>
一篇文章解决HTTP 请求头!
查看>>
学习日记02
查看>>
学习日记03
查看>>
学习日记04
查看>>
学习日记08(元组、字典、集合)
查看>>
js自定义数据顺序进行升序或者降序排序
查看>>
【零】简单数仓框架优化、配置及基准测试
查看>>
【零】Linux中MySQL安装
查看>>
Sqoop的安装及测试
查看>>
Kylin的简单使用
查看>>
Presto的概念和安装使用
查看>>
Druid的Web页面使用
查看>>
Scala-HelloWorld
查看>>
Scala-IDEA中环境部署
查看>>
Scala-HelloWorld解析
查看>>
Scala-变量和数据类型
查看>>