Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4e6701cc59a717dcb580184be50e9a7d57d89ee5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*******************************************************************************
 *  Copyright (c) 2005, 2011 IBM Corporation and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.internal.ui.viewers.model.provisional;



/**
 * Describes a change within a model. A delta is a hierarchical description of changes
 * within a model. It consists of a tree of nodes. Each node references an element
 * from a model describing how that element changed. A model proxy fires model deltas
 * as its model changes in order to update views displaying that model.
 * <p>
 * Each node in a model delta describes the following:
 * <ul>
 * <li>the type of change - for example, whether an element was added, removed,
 *  or whether its content or state changed</li>
 * <li>action to consider - for example, select or reveal the element</li>
 * </ul>
 * </p>
 * <p>
 * @noimplement Clients are not intended to implement this interface directly. Instead, clients
 * creating and firing model deltas should create instances of {@link ModelDelta}.
 * </p>
 * @since 3.2
 */
public interface IModelDelta {

	// types of changes

	/**
	 * Indicates an element has not changed, but has children that have
	 * changed in some way.
	 */
	int NO_CHANGE = 0;
	/**
	 * Indicates an element has been added to the model, as described by
	 * its path.
	 */
	int ADDED = 1;
	/**
	 * Indicates an element has been removed from the model, as described by
	 * its path.
	 */
	int REMOVED = 1 << 1;
	/**
	 * Indicates an element has been replaced in the model, as described by
	 * its path. In this case a replacement element is also specified in the
	 * model delta node.
	 */
	int REPLACED = 1 << 3;
	/**
	 * Indicates an element has been inserted into the model, as described
	 * by its path and index.
	 */
	int INSERTED = 1 << 4;

	// how an element changed

	/**
	 * Indicates an elements content has changed (i.e. its children).
	 */
	int CONTENT = 1 << 10;
	/**
	 * Indicates an elements state has changed (i.e. label)
	 */
	int STATE = 1 << 11;

	// Suggested actions

	/**
	 * Suggests that the element should be expanded, as described by its path.
	 */
	int EXPAND = 1 << 20;
	/**
	 * Suggests that the element should be selected, as described by its path.
	 */
	int SELECT = 1 << 21;

	/**
	 * Suggests that the element should be revealed, as described by its path.
	 * @since 3.3
	 */
	int REVEAL = 1 << 24;

	/**
	 * Indicates a model proxy should be installed for the given element
	 * @since 3.3
	 */
	int INSTALL = 1 << 22;

	/**
	 * Indicates a model proxy should be uninstalled for the given element
	 * @since 3.3
	 */
	int UNINSTALL = 1 << 23;

	/**
	 * Suggests that the element should be collapsed, as described by its path.
	 * @since 3.3
	 */
	int COLLAPSE = 1 << 25;

	/**
	 * Flag indicating that the view layout deltas should override the
	 * model selection policy.  This flag can be used in conjunction with
	 * SELECT and REVEAL flags.
	 *
	 * @see IModelSelectionPolicy
=	 * @since 3.5
	 */
	int FORCE = 1 << 26;

	/**
	 * Returns the parent of this node, or <code>null</code> if this is
	 * a root node.
	 *
	 * @return parent node or <code>null</code> if this is a root node
	 */
	IModelDelta getParentDelta();

	/**
	 * Returns the model element this node describes.
	 *
	 * @return associated model element
	 */
	Object getElement();

	/**
	 * Returns flags describing how this element changed. A bit mask of the
	 * change type constants described in {@link IModelDelta}.
	 *
	 * @return change flags
	 */
	int getFlags();

	/**
	 * Returns nodes describing changed children, possibly an empty collection.
	 *
	 * @return changed children, possibly empty
	 */
	IModelDelta[] getChildDeltas();

	/**
	 * When a node indicates the <code>IModelDelta.REPLACED</code> flag, this method
	 * returns the replacement element, otherwise <code>null</code>.
	 *
	 * @return replacement element or <code>null</code>
	 */
	Object getReplacementElement();

	/**
	 * Returns this node's index in its parents child collection or -1 if unknown.
	 * This attribute is required when expanding or selecting an element.
	 * <p>
	 * When a node indicates the <code>IModelDelta.INSERTED</code> flag, this method
	 * returns the index that the new element should be inserted at relative to its
	 * parents children, otherwise -1.
	 * </p>
	 * @return insertion index or -1
	 */
	int getIndex();

	/**
	 * Returns the total number of children this element has, or -1 if unknown. Note
	 * that this number may be greater than the number of child delta nodes for this
	 * node, since not all children may be reporting deltas.
	 * <p>
	 * This attribute is required when expanding or selecting an element.
	 * </p>
	 *
	 * @return total number of child elements this element has
	 */
	int getChildCount();

	/**
	 * Accepts the given visitor.
	 *
	 * @param visitor delta visitor to accept
	 * @since 3.3
	 */
	void accept(IModelDeltaVisitor visitor);

}

Back to the top