Package org.eclipse.jface.preference
Class PreferenceNode
- java.lang.Object
-
- org.eclipse.jface.preference.PreferenceNode
-
- All Implemented Interfaces:
IPreferenceNode
public class PreferenceNode extends Object implements IPreferenceNode
A concrete implementation of a node in a preference dialog tree. This class also supports lazy creation of the node's preference page.
-
-
Constructor Summary
Constructors Constructor Description PreferenceNode(String id)
Creates a new preference node with the given id.PreferenceNode(String id, String label, ImageDescriptor image, String className)
Creates a preference node with the given id, label, and image, and lazily-loaded preference page.PreferenceNode(String id, IPreferencePage preferencePage)
Creates a preference node with the given id and preference page.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IPreferenceNode node)
Adds the given preference node as a subnode of this preference node.void
createPage()
Creates the preference page for this node.void
disposeResources()
Release the page managed by this node, and any SWT resources held onto by this node (Images, Fonts, etc).IPreferenceNode
findSubNode(String id)
Returns the subnode of this contribution node with the given node id.String
getId()
Returns the id of this contribution node.protected ImageDescriptor
getImageDescriptor()
Returns the image descriptor for this node.Image
getLabelImage()
Returns the image used to present this node in a preference dialog.String
getLabelText()
Returns the text label used to present this node in a preference dialog.IPreferencePage
getPage()
Returns the preference page for this node.IPreferenceNode[]
getSubNodes()
Returns an iterator over the subnodes (immediate children) of this contribution node.IPreferenceNode
remove(String id)
Removes the subnode of this preference node with the given node id.boolean
remove(IPreferenceNode node)
Removes the given preference node from the list of subnodes (immediate children) of this node.void
setPage(IPreferencePage newPage)
Set the current page to be newPage.
-
-
-
Constructor Detail
-
PreferenceNode
public PreferenceNode(String id)
Creates a new preference node with the given id. The new node has no subnodes.- Parameters:
id
- the node id
-
PreferenceNode
public PreferenceNode(String id, String label, ImageDescriptor image, String className)
Creates a preference node with the given id, label, and image, and lazily-loaded preference page. The preference node assumes (sole) responsibility for disposing of the image; this will happen when the node is disposed.- Parameters:
id
- the node idlabel
- the label used to display the node in the preference dialog's treeimage
- the image displayed left of the label in the preference dialog's tree, ornull
if noneclassName
- the class name of the preference page; this class must implementIPreferencePage
-
PreferenceNode
public PreferenceNode(String id, IPreferencePage preferencePage)
Creates a preference node with the given id and preference page. The title of the preference page is used for the node label. The node will not have an image.- Parameters:
id
- the node idpreferencePage
- the preference page
-
-
Method Detail
-
add
public void add(IPreferenceNode node)
Description copied from interface:IPreferenceNode
Adds the given preference node as a subnode of this preference node.- Specified by:
add
in interfaceIPreferenceNode
- Parameters:
node
- the node to add
-
createPage
public void createPage()
Description copied from interface:IPreferenceNode
Creates the preference page for this node.- Specified by:
createPage
in interfaceIPreferenceNode
-
disposeResources
public void disposeResources()
Description copied from interface:IPreferenceNode
Release the page managed by this node, and any SWT resources held onto by this node (Images, Fonts, etc). Note that nodes are reused so this is not a call to dispose the node itself.- Specified by:
disposeResources
in interfaceIPreferenceNode
-
findSubNode
public IPreferenceNode findSubNode(String id)
Description copied from interface:IPreferenceNode
Returns the subnode of this contribution node with the given node id.- Specified by:
findSubNode
in interfaceIPreferenceNode
- Parameters:
id
- the preference node id- Returns:
- the subnode, or
null
if none
-
getId
public String getId()
Description copied from interface:IPreferenceNode
Returns the id of this contribution node. This id identifies a contribution node relative to its parent.- Specified by:
getId
in interfaceIPreferenceNode
- Returns:
- the node id
-
getImageDescriptor
protected ImageDescriptor getImageDescriptor()
Returns the image descriptor for this node.- Returns:
- the image descriptor
-
getLabelImage
public Image getLabelImage()
Description copied from interface:IPreferenceNode
Returns the image used to present this node in a preference dialog.- Specified by:
getLabelImage
in interfaceIPreferenceNode
- Returns:
- the image for this node, or
null
if there is no image for this node
-
getLabelText
public String getLabelText()
Description copied from interface:IPreferenceNode
Returns the text label used to present this node in a preference dialog.- Specified by:
getLabelText
in interfaceIPreferenceNode
- Returns:
- the text label for this node, or
null
if there is no label for this node
-
getPage
public IPreferencePage getPage()
Description copied from interface:IPreferenceNode
Returns the preference page for this node.- Specified by:
getPage
in interfaceIPreferenceNode
- Returns:
- the preference page
-
getSubNodes
public IPreferenceNode[] getSubNodes()
Description copied from interface:IPreferenceNode
Returns an iterator over the subnodes (immediate children) of this contribution node.- Specified by:
getSubNodes
in interfaceIPreferenceNode
- Returns:
- an IPreferenceNode array containing the child nodes
-
remove
public IPreferenceNode remove(String id)
Description copied from interface:IPreferenceNode
Removes the subnode of this preference node with the given node id.- Specified by:
remove
in interfaceIPreferenceNode
- Parameters:
id
- the subnode id- Returns:
- the removed subnode, or
null
if none
-
remove
public boolean remove(IPreferenceNode node)
Description copied from interface:IPreferenceNode
Removes the given preference node from the list of subnodes (immediate children) of this node.- Specified by:
remove
in interfaceIPreferenceNode
- Parameters:
node
- the node to remove- Returns:
true
if the node was removed, andfalse
otherwise
-
setPage
public void setPage(IPreferencePage newPage)
Set the current page to be newPage.- Parameters:
newPage
-
-
-