Preferences

org.eclipse.core.runtime.preferences

3.0

The preferences extension point allows plug-ins to add new preference scopes to the Eclipse preference mechanism as well as specify the class to run to initialize default preference values at runtime.

<!ELEMENT extension (scope* , initializer* , modifier*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT scope EMPTY>

<!ATTLIST scope

name  CDATA #REQUIRED

class CDATA #REQUIRED>

Element describing a client's definiton of a new preference scope.



<!ELEMENT initializer EMPTY>

<!ATTLIST initializer

class CDATA #REQUIRED>

Element which defines the class to use for runtime preference initialization.



<!ELEMENT modifier EMPTY>

<!ATTLIST modifier

class CDATA #REQUIRED>

Element which defines the class to use for preference modification listening.



Following is an example of a preference scope declaration. This example declares that this plug-in will provide a preference implementation for the scope "foo". It also declares that when the default values are loaded for this plug-in, the class "MyPreferenceInitializer" contains code to be run to initialize preference default values at runtime.

      

<extension point=

"org.eclipse.core.runtime.preferences"

>

<scope name=

"foo"

class=

"com.example.FooPrefs"

/>

<initializer class=

"com.example.MyPreferenceInitializer"

/>

<modifier class=

"com.example.MyModifyListener"

/>

</extension>

The preference service (obtained by calling org.eclipse.core.runtime.Platform.getPreferencesService()) is the hook into the Eclipse preference mechanism.

The org.eclipse.core.runtime plug-in provides preference implementations for the "configuration", "instance", and "default" scopes. The org.eclipse.core.resources plug-in provides an implementation for "project" preferences.