Package org.eclipse.jface.preference
Class PreferenceManager
java.lang.Object
org.eclipse.jface.preference.PreferenceManager
A preference manager maintains a hierarchy of preference nodes and
associated preference pages.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Post-order means visit the children, and then the root.static final int
Pre-order traversal means visit the root first, then the children. -
Constructor Summary
ConstructorDescriptionCreates a new preference manager.PreferenceManager
(char separatorChar) Creates a new preference manager with the given path separator.PreferenceManager
(char separatorChar, PreferenceNode rootNode) Creates a new preference manager with the given path separator and root node. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTo
(String path, IPreferenceNode node) Adds the given preference node as a subnode of the node at the given path.void
addToRoot
(IPreferenceNode node) Adds the given preference node as a subnode of the root.protected void
buildSequence
(IPreferenceNode node, List<IPreferenceNode> sequence, int order) Recursively enumerates all nodes at or below the given node and adds them to the given list in the given order.Finds and returns the contribution node at the given path.protected IPreferenceNode
find
(String path, IPreferenceNode top) Finds and returns the preference node directly below the top at the given path.getElements
(int order) Returns all preference nodes managed by this manager.protected IPreferenceNode
getRoot()
Returns the root node.final IPreferenceNode[]
Returns the root level nodes of this preference manager.Removes the preference node at the given path.boolean
remove
(IPreferenceNode node) Removes the given preference node if it is managed by this contribution manager.void
Removes all contribution nodes known to this manager.
-
Field Details
-
PRE_ORDER
public static final int PRE_ORDERPre-order traversal means visit the root first, then the children.- See Also:
-
POST_ORDER
public static final int POST_ORDERPost-order means visit the children, and then the root.- See Also:
-
-
Constructor Details
-
PreferenceManager
public PreferenceManager()Creates a new preference manager. -
PreferenceManager
public PreferenceManager(char separatorChar) Creates a new preference manager with the given path separator.- Parameters:
separatorChar
- preference node separator
-
PreferenceManager
Creates a new preference manager with the given path separator and root node.- Parameters:
separatorChar
- the separator characterrootNode
- the root node.- Since:
- 3.4
-
-
Method Details
-
addTo
Adds the given preference node as a subnode of the node at the given path.- Parameters:
path
- the pathnode
- the node to add- Returns:
true
if the add was successful, andfalse
if there is no contribution at the given path
-
addToRoot
Adds the given preference node as a subnode of the root.- Parameters:
node
- the node to add, which must implementIPreferenceNode
-
buildSequence
Recursively enumerates all nodes at or below the given node and adds them to the given list in the given order.- Parameters:
node
- the starting nodesequence
- a read-write list of preference nodes (element type:IPreferenceNode
) in the given orderorder
- the traversal order, one ofPRE_ORDER
andPOST_ORDER
-
find
Finds and returns the contribution node at the given path.- Parameters:
path
- the path- Returns:
- the node, or
null
if none
-
find
Finds and returns the preference node directly below the top at the given path.- Parameters:
path
- the pathtop
- top at the given path- Returns:
- the node, or
null
if none - Since:
- 3.1
-
getElements
Returns all preference nodes managed by this manager.- Parameters:
order
- the traversal order, one ofPRE_ORDER
andPOST_ORDER
- Returns:
- a list of preference nodes
(element type:
IPreferenceNode
) in the given order
-
getRoot
Returns the root node. Note that the root node is a special internal node that is used to collect together all the nodes that have no parent; it is not given out to clients.- Returns:
- the root node
-
getRootSubNodes
Returns the root level nodes of this preference manager.- Returns:
- an array containing the root nodes
- Since:
- 3.2
-
remove
Removes the preference node at the given path.- Parameters:
path
- the path- Returns:
- the node that was removed, or
null
if there was no node at the given path
-
remove
Removes the given preference node if it is managed by this contribution manager.- Parameters:
node
- the node to remove- Returns:
true
if the node was removed, andfalse
otherwise
-
removeAll
public void removeAll()Removes all contribution nodes known to this manager.
-