KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > viewers > model > provisional > IModelDelta


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.debug.internal.ui.viewers.model.provisional;
12
13
14
15 /**
16  * Describes a change within a model. A delta is a hierarchical description of changes
17  * within a model. It consists of a tree of nodes. Each node references an element
18  * from a model describing how that element changed. A model proxy fires model deltas
19  * as its model changes in order to update views displaying that model.
20  * <p>
21  * Each node in a model delta describes the following:
22  * <ul>
23  * <li>the type of change - for example, whether an element was added, removed,
24  * or whether its content or state changed</li>
25  * <li>action to consider - for example, select or reveal the element</li>
26  * </ul>
27  * </p>
28  * <p>
29  * Clients are not intended to implement this interface directly. Instead, clients
30  * creating and firing model deltas should create instances of
31  * {@link org.eclipse.debug.internal.ui.viewers.update.ModelDelta}.
32  * </p>
33  * </p>
34  * @since 3.2
35  */

36 public interface IModelDelta {
37     
38     // types of changes
39

40     /**
41      * Indicates an element has not changed, but has children that have
42      * changed in some way.
43      */

44     public static int NO_CHANGE = 0;
45     /**
46      * Indicates an element has been added to the model, as described by
47      * its path.
48      */

49     public static int ADDED = 1;
50     /**
51      * Indicates an element has been removed from the model, as described by
52      * its path.
53      */

54     public static int REMOVED = 1 << 1;
55     /**
56      * Indicates an element has been replaced in the model, as described by
57      * its path. In this case a replacement element is also specified in the
58      * model delta node.
59      */

60     public static int REPLACED = 1 << 3;
61     /**
62      * Indicates an element has been inserted into the model, as described
63      * by its path and index.
64      */

65     public static int INSERTED = 1 << 4;
66     
67     // how an element changed
68

69     /**
70      * Indicates an elements content has changed (i.e. its children).
71      */

72     public static int CONTENT = 1 << 10;
73     /**
74      * Indicates an elements state has changed (i.e. label)
75      */

76     public static int STATE = 1 << 11;
77     
78     // Suggested actions
79

80     /**
81      * Suggests that the element should be expanded, as described by its path.
82      */

83     public static int EXPAND = 1 << 20;
84     /**
85      * Suggests that the element should be selected, as described by its path.
86      */

87     public static int SELECT = 1 << 21;
88     
89     /**
90      * Suggests that the element should be revealed, as described by its path.
91      * @since 3.3
92      */

93     public static int REVEAL = 1 << 24;
94     
95     /**
96      * Indicates a model proxy should be installed for the given element
97      * @since 3.3
98      */

99     public static int INSTALL = 1 << 22;
100     
101     /**
102      * Indicates a model proxy should be uninstalled for the given element
103      * @since 3.3
104      */

105     public static int UNINSTALL = 1 << 23;
106     
107     /**
108      * Suggests that the element should be collapsed, as described by its path.
109      * @since 3.3
110      */

111     public static int COLLAPSE = 1 << 25;
112     
113     /**
114      * Returns the parent of this node, or <code>null</code> if this is
115      * a root node.
116      *
117      * @return parent node or <code>null</code> if this is a root node
118      */

119     public IModelDelta getParentDelta();
120     
121     /**
122      * Returns the model element this node describes.
123      *
124      * @return associated model element
125      */

126     public Object JavaDoc getElement();
127     
128     /**
129      * Returns flags describing how this element changed. A bit mask of the
130      * change type constants described in {@link IModelDelta}.
131      *
132      * @return change flags
133      */

134     public int getFlags();
135     
136     /**
137      * Returns nodes describing changed children, possibly an empty collection.
138      *
139      * @return changed children, possibly empty
140      */

141     public IModelDelta[] getChildDeltas();
142     
143     /**
144      * When a node indicates the <code>IModelDelta.REPLACED</code> flag, this method
145      * returns the replacement element, otherwise <code>null</code>.
146      *
147      * @return replacement element or <code>null</code>
148      */

149     public Object JavaDoc getReplacementElement();
150     
151     /**
152      * Returns this node's index in its parents child collection or -1 if unknown.
153      * This attribute is required when expanding or selecting an element.
154      * <p>
155      * When a node indicates the <code>IModelDelta.INSERTED</code> flag, this method
156      * returns the index that the new element should be inserted at relative to its
157      * parents children, otherwise -1.
158      * </p>
159      * @return insertion index or -1
160      */

161     public int getIndex();
162     
163     /**
164      * Returns the total number of children this element has, or -1 if unknown. Note
165      * that this number may be greater than the number of child delta nodes for this
166      * node, since not all children may be reporting deltas.
167      * <p>
168      * This attribute is required when expanding or selecting an element.
169      * </p>
170      *
171      * @return total number of child elements this element has
172      */

173     public int getChildCount();
174     
175     /**
176      * Accepts the given visitor.
177      *
178      * @param visitor
179      * @since 3.3
180      */

181     public void accept(IModelDeltaVisitor visitor);
182     
183 }
184
Popular Tags