org.mailster.gui.prefs.widgets
Class ExtendedPreferenceNode

java.lang.Object
  extended by org.eclipse.jface.preference.PreferenceNode
      extended by org.mailster.gui.prefs.widgets.ExtendedPreferenceNode
All Implemented Interfaces:
org.eclipse.jface.preference.IPreferenceNode

public class ExtendedPreferenceNode
extends org.eclipse.jface.preference.PreferenceNode

Extends PreferenceNode to support easy handling of different icons in the TreeViewer and PreferencePage of a JFace PreferenceDialog. This class changes the original behaviour to that effect that the icon of a PreferencePage stays untouched and has to be set in the implementing class itself.

Author:
Sebastian Machhausen, Edouard De Oliveira

Field Summary
private  java.lang.String classname
          The name of the class that implements the PreferencePage bound to this ExtendedPreferenceNode
 
Constructor Summary
ExtendedPreferenceNode(java.lang.String id)
          Creates an ExtendedPreferenceNode with the given id.
ExtendedPreferenceNode(java.lang.String id, org.eclipse.jface.preference.IPreferencePage preferencePage)
          Creates an ExtendedPreferenceNode with the given id and preference page.
ExtendedPreferenceNode(java.lang.String id, java.lang.String label, org.eclipse.jface.resource.ImageDescriptor image, java.lang.String className)
          Creates an ExtendedPreferenceNode with the given id, label, and image, and lazily-loaded preference page.
 
Method Summary
private  java.lang.Object createObject(java.lang.String className)
          Creates a new instance of the given class className.
 void createPage()
          Creates the PreferencePage according to the settings in this ExtendedPreferenceNode.
 
Methods inherited from class org.eclipse.jface.preference.PreferenceNode
add, disposeResources, findSubNode, getId, getImageDescriptor, getLabelImage, getLabelText, getPage, getSubNodes, remove, remove, setPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classname

private java.lang.String classname
The name of the class that implements the PreferencePage bound to this ExtendedPreferenceNode

Constructor Detail

ExtendedPreferenceNode

public ExtendedPreferenceNode(java.lang.String id)
Creates an ExtendedPreferenceNode with the given id. The new node has nosubnodes.

Parameters:
id - the node id

ExtendedPreferenceNode

public ExtendedPreferenceNode(java.lang.String id,
                              java.lang.String label,
                              org.eclipse.jface.resource.ImageDescriptor image,
                              java.lang.String className)
Creates an ExtendedPreferenceNode 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

ExtendedPreferenceNode

public ExtendedPreferenceNode(java.lang.String id,
                              org.eclipse.jface.preference.IPreferencePage preferencePage)
Creates an ExtendedPreferenceNode 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 Detail

createPage

public void createPage()
Creates the PreferencePage according to the settings in this ExtendedPreferenceNode.

Specified by:
createPage in interface org.eclipse.jface.preference.IPreferenceNode
Overrides:
createPage in class org.eclipse.jface.preference.PreferenceNode

createObject

private java.lang.Object createObject(java.lang.String className)
Creates a new instance of the given class className.

Parameters:
className -
Returns:
new Object or null in case of failures