KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > preference > IPreferenceNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.preference;
12
13 import org.eclipse.swt.graphics.Image;
14
15 /**
16  * Interface to a node in a preference dialog.
17  * A preference node maintains a label and image used to display the
18  * node in a preference dialog (usually in the form of a tree),
19  * as well as the preference page this node stands for.
20  *
21  * The node may use lazy creation for its page
22  *
23  * Note that all preference nodes must be dispose their resources.
24  * The node must dispose the page managed by this node, and any SWT resources
25  * allocated by this node (Images, Fonts, etc).
26  * However the node itself may be reused.
27  */

28 public interface IPreferenceNode {
29     /**
30      * Adds the given preference node as a subnode of this
31      * preference node.
32      *
33      * @param node the node to add
34      */

35     public void add(IPreferenceNode node);
36
37     /**
38      * Creates the preference page for this node.
39      */

40     public void createPage();
41
42     /**
43      * Release the page managed by this node, and any SWT resources
44      * held onto by this node (Images, Fonts, etc).
45      *
46      * Note that nodes are reused so this is not a call to dispose the
47      * node itself.
48      */

49     public void disposeResources();
50
51     /**
52      * Returns the subnode of this contribution node with the given node id.
53      *
54      * @param id the preference node id
55      * @return the subnode, or <code>null</code> if none
56      */

57     public IPreferenceNode findSubNode(String JavaDoc id);
58
59     /**
60      * Returns the id of this contribution node.
61      * This id identifies a contribution node relative to its parent.
62      *
63      * @return the node id
64      */

65     public String JavaDoc getId();
66
67     /**
68      * Returns the image used to present this node in a preference dialog.
69      *
70      * @return the image for this node, or <code>null</code>
71      * if there is no image for this node
72      */

73     public Image getLabelImage();
74
75     /**
76      * Returns the text label used to present this node in a preference dialog.
77      *
78      * @return the text label for this node, or <code>null</code>
79      * if there is no label for this node
80      */

81     public String JavaDoc getLabelText();
82
83     /**
84      * Returns the preference page for this node.
85      *
86      * @return the preference page
87      */

88     public IPreferencePage getPage();
89
90     /**
91      * Returns an iterator over the subnodes (immediate children)
92      * of this contribution node.
93      *
94      * @return an IPreferenceNode array containing the child nodes
95      */

96     public IPreferenceNode[] getSubNodes();
97
98     /**
99      * Removes the subnode of this preference node with the given node id.
100      *
101      * @param id the subnode id
102      * @return the removed subnode, or <code>null</code> if none
103      */

104     public IPreferenceNode remove(String JavaDoc id);
105
106     /**
107      * Removes the given preference node from the list of subnodes
108      * (immediate children) of this node.
109      *
110      * @param node the node to remove
111      * @return <code>true</code> if the node was removed,
112      * and <code>false</code> otherwise
113      */

114     public boolean remove(IPreferenceNode node);
115 }
116
Popular Tags