KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > ElementChangedEvent


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.jdt.core;
12
13 import java.util.EventObject JavaDoc;
14
15 /**
16  * An element changed event describes a change to the structure or contents
17  * of a tree of Java elements. The changes to the elements are described by
18  * the 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 JavaDoc {
28     
29     /**
30      * Event type constant (bit mask) indicating an after-the-fact
31      * report of creations, deletions, and modifications
32      * to one or more Java element(s) expressed as a hierarchical
33      * java element delta as returned by <code>getDelta()</code>.
34      *
35      * Note: this notification occurs during the corresponding POST_CHANGE
36      * resource change notification, and contains a full delta accounting for
37      * any JavaModel operation and/or resource change.
38      *
39      * @see IJavaElementDelta
40      * @see org.eclipse.core.resources.IResourceChangeEvent
41      * @see #getDelta()
42      * @since 2.0
43      */

44     public static final int POST_CHANGE = 1;
45
46     /**
47      * Event type constant (bit mask) indicating an after-the-fact
48      * report of creations, deletions, and modifications
49      * to one or more Java element(s) expressed as a hierarchical
50      * java element delta as returned by <code>getDelta</code>.
51      *
52      * Note: this notification occurs during the corresponding PRE_AUTO_BUILD
53      * resource change notification. The delta, which is notified here, only contains
54      * information relative to the previous JavaModel operations (in other words,
55      * it ignores the possible resources which have changed outside Java operations).
56      * In particular, it is possible that the JavaModel be inconsistent with respect to
57      * resources, which got modified outside JavaModel operations (it will only be
58      * fully consistent once the POST_CHANGE notification has occurred).
59      *
60      * @see IJavaElementDelta
61      * @see org.eclipse.core.resources.IResourceChangeEvent
62      * @see #getDelta()
63      * @since 2.0
64      * @deprecated - no longer used, such deltas are now notified during POST_CHANGE
65      */

66     public static final int PRE_AUTO_BUILD = 2;
67
68     /**
69      * Event type constant (bit mask) indicating an after-the-fact
70      * report of creations, deletions, and modifications
71      * to one or more Java element(s) expressed as a hierarchical
72      * java element delta as returned by <code>getDelta</code>.
73      *
74      * Note: this notification occurs as a result of a working copy reconcile
75      * operation.
76      *
77      * @see IJavaElementDelta
78      * @see org.eclipse.core.resources.IResourceChangeEvent
79      * @see #getDelta()
80      * @since 2.0
81      */

82     public static final int POST_RECONCILE = 4;
83     
84     private static final long serialVersionUID = -8947240431612844420L; // backward compatible
85

86     /*
87      * Event type indicating the nature of this event.
88      * It can be a combination either:
89      * - POST_CHANGE
90      * - PRE_AUTO_BUILD
91      * - POST_RECONCILE
92      */

93     private int type;
94     
95     /**
96      * Creates an new element changed event (based on a <code>IJavaElementDelta</code>).
97      *
98      * @param delta the Java element delta.
99      * @param type the type of delta (ADDED, REMOVED, CHANGED) this event contains
100      */

101     public ElementChangedEvent(IJavaElementDelta delta, int type) {
102         super(delta);
103         this.type = type;
104     }
105     /**
106      * Returns the delta describing the change.
107      *
108      * @return the delta describing the change
109      */

110     public IJavaElementDelta getDelta() {
111         return (IJavaElementDelta) this.source;
112     }
113     
114     /**
115      * Returns the type of event being reported.
116      *
117      * @return one of the event type constants
118      * @see #POST_CHANGE
119      * @see #PRE_AUTO_BUILD
120      * @see #POST_RECONCILE
121      * @since 2.0
122      */

123     public int getType() {
124         return this.type;
125     }
126 }
127
Popular Tags