KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

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

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

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

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

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

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

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

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

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

86     public static int SELECT = 1 << 21;
87     /**
88      * Returns the parent of this node, or <code>null</code> if this is
89      * a root node.
90      *
91      * @return parent node or <code>null</code> if this is a root node
92      */

93     public IModelDelta getParent();
94     
95     /**
96      * Returns the model element this node describes.
97      *
98      * @return associated model element
99      */

100     public Object JavaDoc getElement();
101     
102     /**
103      * Returns flags describing how this element changed. A bit mask of the
104      * change type constants described in {@link IModelDelta}.
105      *
106      * @return change flags
107      */

108     public int getFlags();
109     
110     /**
111      * Returns nodes describing changed children, possibly an empty collection.
112      *
113      * @return changed children, possibly empty
114      */

115     public ModelDelta[] getNodes();
116     
117     /**
118      * When a node indicates the <code>IModelDelta.REPLACED</code> flag, this method
119      * returns the replacement element, otherwise <code>null</code>.
120      *
121      * @return replacement element or <code>null</code>
122      */

123     public Object JavaDoc getReplacementElement();
124     
125     /**
126      * When a node indicates the <code>IModelDelta.INSERTED</code> flag, this method
127      * returns the index that the new element should be inserted at relative to its
128      * parents children, otherwise -1.
129      *
130      * @return insertion index or -1
131      */

132     public int getIndex();
133     
134 }
135
Popular Tags