|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.editor.Settings
public class Settings
Configurable settings that editor uses. All the methods are static The editor is configurable mainly by using the following static method in Settings class: org.netbeans.editor.Settings.setValue(Class kitClass, String settingName, Object newValue); kitClass - this is the class of the editor kit for which the setting is changed. The current hierarchy of editor kits starts with the org.netbeans.editor.BaseKit kit, the begining of the whole kit hierarchy. There should be a different editor kit for each mime-type. When the particular setting is not set foar a given kit, then the superclass of the given kit class is retrieved and the search for the setting value is performed. Example: If the java document calls Settings.getValue() to retrieve the value for TAB_SIZE setting and it passes JavaKit.class as the kitClass parameter and the setting has no value on this level, then the super class of the JavaKit is retrieved (by using Class.getSuperclass() call) which is BaseKit in this case and the search for the value of TAB_SIZE setting is performed again. It is finished by reaching the null value for the kitClass. The null value can be also used as the kitClass parameter value. In a more general look not only the kit-class hierarchy could be used in Settings. Any class inheritance hierarchy could be used here having the null as the common root. This way the inheritance of the setting values is guaranteed. By changing the setting value on the BaseKit level (or even on the null level), all the kit classes that don't override the particular setting are affected. settingName - name of the setting to change. The base setting names are defined as public String constants in SettingsNames class. The additional packages that extend the basic editor functionality can define additional setting names. newValue - new value for the setting. It must be always an object even if the setting is logicaly the basic datatype such as int (java.lang.Integer would be used in this case). A particular class types that can be used for the value of the settings are documented for each setting. WARNING! Please read carefully the description for each option you're going to change as you can make the editor stop working if you'll change the setting in a wrong way.
Nested Class Summary | |
---|---|
static class |
Settings.AbstractInitializer
Abstract implementation of the initializer dealing with the name. |
static interface |
Settings.Evaluator
Evaluator can be used in cases when value of some setting depends on the value for other setting and it allows to compute the value dynamically based on the other setting(s) value. |
static interface |
Settings.Filter
Filter is applied on every value or KitAndValue pairs returned from getValue(). |
static class |
Settings.FilterInitializerSorter
Initializer sorter that delegates to another sorter. |
static interface |
Settings.Initializer
Initializer of the settings updates the map filled with settings for the particular kit class when asked. |
static interface |
Settings.InitializerSorter
Sort the settings initializers that were added to the settings. |
static class |
Settings.KitAndValue
Kit class and value pair |
Field Summary | |
---|---|
static int |
CORE_LEVEL
Core level used by the settings initializers. |
static int |
EXTENSION_LEVEL
Extension level used by the settings initializers. |
static int |
OPTION_LEVEL
Option level used by the settings initializers. |
static int |
SYSTEM_LEVEL
System level used by the settings initializers. |
static int |
USER_LEVEL
User level used by the settings initializers. |
Method Summary | |
---|---|
static void |
addFilter(Settings.Filter f)
Add filter instance to the list of current filters. |
static void |
addInitializer(Settings.Initializer i)
Add the initializer at the system level and perform reset. |
static void |
addInitializer(Settings.Initializer i,
int level)
Add initializer instance to the list of current initializers. |
static void |
addSettingsChangeListener(SettingsChangeListener l)
Add weak listener to listen to change of any property. |
static Settings.InitializerSorter |
getInitializerSorter()
Get the current initializer sorter. |
static Object |
getValue(Class kitClass,
String settingName)
Get the value and evaluate the evaluators. |
static Object |
getValue(Class kitClass,
String settingName,
boolean evaluateEvaluators)
Get the property by searching the given kit class settings and if not found then the settings for super class and so on. |
static Settings.KitAndValue[] |
getValueHierarchy(Class kitClass,
String settingName)
Get the value hierarchy and evaluate the evaluators |
static Settings.KitAndValue[] |
getValueHierarchy(Class kitClass,
String settingName,
boolean evaluateEvaluators)
Get array of KitAndValue objects sorted from the given kit class to its deepest superclass and the last member can be filled whether there is global setting (kit class of that member would be null). |
static String |
initializersToString()
Debug the current initializers |
static void |
propagateValue(Class kitClass,
String settingName,
Object newValue)
Set the value for the current kit and propagate it to all the children of the given kit by removing the possible values for the setting from the children kit setting maps. |
static void |
removeFilter(Settings.Filter f)
|
static void |
removeInitializer(String name)
Remove the initializer of the given name from all the levels where it occurs. |
static void |
removeSettingsChangeListener(SettingsChangeListener l)
Remove listener for changes in properties |
static void |
reset()
Reset all the settings and fire the change of the settings so that all the listeners will be notified and will reload the settings. |
static void |
setInitializerSorter(Settings.InitializerSorter initializerSorter)
Set the current initializer sorter. |
static void |
setValue(Class kitClass,
String settingName,
Object newValue)
Set the new value for property on kit level. |
static void |
touchValue(Class kitClass,
String settingName)
Don't change the value of the setting, but fire change event. |
static void |
update(Runnable r)
Run the given runnable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CORE_LEVEL
public static final int SYSTEM_LEVEL
public static final int EXTENSION_LEVEL
public static final int OPTION_LEVEL
public static final int USER_LEVEL
Method Detail |
---|
public static void addInitializer(Settings.Initializer i)
public static void addInitializer(Settings.Initializer i, int level)
i
- initializer to add to the current list of initializerslevel
- initializer level. It defines in which order
the initializers will be called. There are currently three levels
CORE_LEVEL, SYSTEM_LEVEL and USER_LEVEL.
It's guaranteed that initializers with the particular level
will be called in the order shown above.
The order of the initializers at the same
level is given by the order of their addition.public static void removeInitializer(String name)
name
- name of the initializer sorter to remove.public static Settings.InitializerSorter getInitializerSorter()
public static void setInitializerSorter(Settings.InitializerSorter initializerSorter)
public static void addFilter(Settings.Filter f)
f
- filter to add to the list of the filterspublic static void removeFilter(Settings.Filter f)
public static Object getValue(Class kitClass, String settingName)
public static Object getValue(Class kitClass, String settingName, boolean evaluateEvaluators)
kitClass
- editor kit class for which the value of setting should
be retrieved. The null can be used as the root of the whole hierarchy.settingName
- name of the setting for which the value should
be retrieved
public static Settings.KitAndValue[] getValueHierarchy(Class kitClass, String settingName)
public static Settings.KitAndValue[] getValueHierarchy(Class kitClass, String settingName, boolean evaluateEvaluators)
kitClass
- editor kit class for which the value of setting should
be retrieved. The null can be used as the root of the whole hierarchy.settingName
- name of the setting for which the value should
be retrievedevaluateEvaluators
- whether the evaluators should be evaluated or not
public static void setValue(Class kitClass, String settingName, Object newValue)
kitClass
- editor kit class for which the value of setting should
be set. The null can be used as the root of the whole hierarchy.settingName
- the string used for searching the valuenewValue
- new value to set for the property; the value can
be null to clear the value for the specified kitpublic static void touchValue(Class kitClass, String settingName)
public static void propagateValue(Class kitClass, String settingName, Object newValue)
kitClass
- editor kit class for which the value of setting should
be set. The null can be used as the root of the whole hierarchy.settingName
- the string used for searching the valuenewValue
- new value to set for the property; the value can
be null to clear the value for the specified kitpublic static void update(Runnable r)
public static void reset()
public static String initializersToString()
public static void addSettingsChangeListener(SettingsChangeListener l)
public static void removeSettingsChangeListener(SettingsChangeListener l)
|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |