1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / ElementChangedEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.core;
12
13 import java.util.EventObject;
14
15 /**
16  * An element changed event describes a change to the structure or contents of a
17  * tree of Java elements. The changes to the elements are described by the
18  * associated delta object carried by this event.
19  * <p>
20  * This class is not intended to be instantiated or subclassed by clients.
21  * Instances of this class are automatically created by the Java model.
22  * </p>
23  * 
24  * @see IElementChangedListener
25  * @see IJavaElementDelta
26  */
27 public class ElementChangedEvent extends EventObject {
28
29         /**
30          * 
31          */
32         private static final long serialVersionUID = 1222640386847724934L;
33
34         /**
35          * Event type constant (bit mask) indicating an after-the-fact report of
36          * creations, deletions, and modifications to one or more Java element(s)
37          * expressed as a hierarchical java element delta as returned by
38          * <code>getDelta()</code>.
39          * 
40          * Note: this notification occurs during the corresponding POST_CHANGE
41          * resource change notification, and contains a full delta accounting for
42          * any JavaModel operation and/or resource change.
43          * 
44          * @see IJavaElementDelta
45          * @see org.eclipse.core.resources.IResourceChangeEvent
46          * @see #getDelta()
47          * @since 2.0
48          */
49         public static final int POST_CHANGE = 1;
50
51         /**
52          * Event type constant (bit mask) indicating an after-the-fact report of
53          * creations, deletions, and modifications to one or more Java element(s)
54          * expressed as a hierarchical java element delta as returned by
55          * <code>getDelta</code>.
56          * 
57          * Note: this notification occurs during the corresponding PRE_AUTO_BUILD
58          * resource change notification. The delta, which is notified here, only
59          * contains information relative to the previous JavaModel operations (in
60          * other words, it ignores the possible resources which have changed outside
61          * Java operations). In particular, it is possible that the JavaModel be
62          * inconsistent with respect to resources, which got modified outside
63          * JavaModel operations (it will only be fully consistent once the
64          * POST_CHANGE notification has occurred).
65          * 
66          * @see IJavaElementDelta
67          * @see org.eclipse.core.resources.IResourceChangeEvent
68          * @see #getDelta()
69          * @since 2.0
70          */
71         public static final int PRE_AUTO_BUILD = 2;
72
73         /**
74          * Event type constant (bit mask) indicating an after-the-fact report of
75          * creations, deletions, and modifications to one or more Java element(s)
76          * expressed as a hierarchical java element delta as returned by
77          * <code>getDelta</code>.
78          * 
79          * Note: this notification occurs as a result of a working copy reconcile
80          * operation.
81          * 
82          * @see IJavaElementDelta
83          * @see org.eclipse.core.resources.IResourceChangeEvent
84          * @see #getDelta()
85          * @since 2.0
86          */
87         public static final int POST_RECONCILE = 4;
88
89         /*
90          * Event type indicating the nature of this event. It can be a combination
91          * either: - POST_CHANGE - PRE_AUTO_BUILD - POST_RECONCILE
92          */
93         private int type;
94
95         /**
96          * Creates an new element changed event (based on a
97          * <code>IJavaElementDelta</code>).
98          * 
99          * @param delta
100          *            the Java element delta.
101          */
102         public ElementChangedEvent(IJavaElementDelta delta, int type) {
103                 super(delta);
104                 this.type = type;
105         }
106
107         /**
108          * Returns the delta describing the change.
109          * 
110          * @return the delta describing the change
111          */
112         public IJavaElementDelta getDelta() {
113                 return (IJavaElementDelta) source;
114         }
115
116         /**
117          * Returns the type of event being reported.
118          * 
119          * @return one of the event type constants
120          * @see #POST_CHANGE
121          * @see #PRE_AUTO_BUILD
122          * @see #POST_RECONCILE
123          * @since 2.0
124          */
125         public int getType() {
126                 return this.type;
127         }
128 }