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 Details

    • 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 id
      label - the label used to display the node in the preference dialog's tree
      image - the image displayed left of the label in the preference dialog's tree, or null if none
      className - the class name of the preference page; this class must implement IPreferencePage
    • 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 id
      preferencePage - the preference page
  • Method Details

    • 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 interface IPreferenceNode
      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 interface IPreferenceNode
    • 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 interface IPreferenceNode
    • 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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      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 interface IPreferenceNode
      Parameters:
      node - the node to remove
      Returns:
      true if the node was removed, and false otherwise
    • setPage

      public void setPage(IPreferencePage newPage)
      Set the current page to be newPage.
      Parameters:
      newPage - page to set