KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > IMarkerDelta


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.core.resources;
12
13 import java.util.Map JavaDoc;
14
15 /**
16  * A marker delta describes the change to a single marker.
17  * A marker can either be added, removed or changed.
18  * Marker deltas give access to the state of the marker as it
19  * was (in the case of deletions and changes) before the modifying
20  * operation occurred.
21  * <p>
22  * This interface is not intended to be implemented by clients.
23  * </p>
24  */

25 public interface IMarkerDelta {
26     /**
27      * Returns the object attribute with the given name. The result is an instance of one
28      * of the following classes: <code>String</code>, <code>Integer</code>,
29      * or <code>Boolean</code>.
30      * Returns <code>null</code> if the attribute is undefined.
31      * The set of valid attribute names is defined elsewhere.
32      * <p>
33      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
34      * from the new marker, otherwise it is from the old marker.
35      * </p>
36      * @param attributeName the name of the attribute
37      * @return the value, or <code>null</code> if the attribute is undefined.
38      */

39     public Object JavaDoc getAttribute(String JavaDoc attributeName);
40
41     /**
42      * Returns the integer-valued attribute with the given name.
43      * Returns the given default value if the attribute is undefined
44      * or is not an integer value.
45      * <p>
46      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
47      * from the new marker, otherwise it is from the old marker.
48      * </p>
49      *
50      * @param attributeName the name of the attribute
51      * @param defaultValue the value to use if the attribute does not exist
52      * @return the value or the default value if the attribute is undefined.
53      */

54     public int getAttribute(String JavaDoc attributeName, int defaultValue);
55
56     /**
57      * Returns the string-valued attribute with the given name.
58      * Returns the given default value if the attribute is undefined or
59      * is not a string value.
60      * <p>
61      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
62      * from the new marker, otherwise it is from the old marker.
63      * </p>
64      *
65      * @param attributeName the name of the attribute
66      * @param defaultValue the value to use if the attribute does not exist
67      * @return the value or the default value if the attribute is undefined.
68      */

69     public String JavaDoc getAttribute(String JavaDoc attributeName, String JavaDoc defaultValue);
70
71     /**
72      * Returns the boolean-valued attribute with the given name.
73      * Returns the given default value if the attribute is undefined
74      * or is not a boolean value.
75      * <p>
76      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
77      * from the new marker, otherwise it is from the old marker.
78      * </p>
79      *
80      * @param attributeName the name of the attribute
81      * @param defaultValue the value to use if the attribute does not exist
82      * @return the value or the default value if the attribute is undefined.
83      */

84     public boolean getAttribute(String JavaDoc attributeName, boolean defaultValue);
85
86     /**
87      * Returns a Map with all the attributes for the marker. The result is a Map
88      * whose keys are attributes names and whose values are attribute values.
89      * Each value an instance of one of the following classes: <code>String</code>,
90      * <code>Integer</code>, or <code>Boolean</code>. If the marker has no
91      * attributes then <code>null</code> is returned.
92      * <p>
93      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
94      * from the new marker, otherwise it is from the old marker.
95      * </p>
96      *
97      * @return a map of attribute keys and values (key type : <code>String</code>
98      * value type : <code>String</code>, <code>Integer</code>, or
99      * <code>Boolean</code>) or <code>null</code>.
100      */

101     public Map JavaDoc getAttributes();
102
103     /**
104      * Returns the attributes with the given names. The result is an array
105      * whose elements correspond to the elements of the given attribute name
106      * array. Each element is <code>null</code> or an instance of one
107      * of the following classes: <code>String</code>, <code>Integer</code>,
108      * or <code>Boolean</code>.
109      * <p>
110      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
111      * from the new marker, otherwise it is from the old marker.
112      * </p>
113      *
114      * @param attributeNames the names of the attributes
115      * @return the values of the given attributes.
116      */

117     public Object JavaDoc[] getAttributes(String JavaDoc[] attributeNames);
118
119     /**
120      * Returns the id of the marker. The id of a marker is unique
121      * relative to the resource with which the marker is associated.
122      * Marker ids are not globally unique.
123      *
124      * @return the id of the marker
125      */

126     public long getId();
127
128     /**
129      * Returns the kind of this marker delta:
130      * one of <code>IResourceDelta.ADDED</code>,
131      * <code>IResourceDelta.REMOVED</code>, or <code>IResourceDelta.CHANGED</code>.
132      *
133      * @return the kind of marker delta
134      * @see IResourceDelta#ADDED
135      * @see IResourceDelta#REMOVED
136      * @see IResourceDelta#CHANGED
137      */

138     public int getKind();
139
140     /**
141      * Returns the marker described by this change.
142      * If kind is <code>IResourceDelta.REMOVED</code>, then this is the old marker,
143      * otherwise this is the new marker. Note that if the marker was deleted,
144      * the value returned cannot be used to access attributes.
145      *
146      * @return the marker
147      */

148     public IMarker getMarker();
149
150     /**
151      * Returns the resource with which this marker is associated.
152      *
153      * @return the resource
154      */

155     public IResource getResource();
156
157     /**
158      * Returns the type of this marker.
159      * <p>
160      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
161      * from the new marker, otherwise it is from the old marker.
162      * </p>
163      *
164      * @return the type of this marker
165      */

166     public String JavaDoc getType();
167
168     /**
169      * Returns whether the type of this marker is considered to be a sub-type of
170      * the given marker type.
171      * <p>
172      * If kind is <code>IResourceDelta.ADDED</code>, then the information is
173      * from the new marker, otherwise it is from the old marker.
174      * </p>
175      *
176      * @return boolean <code>true</code>if the marker's type
177      * is the same as (or a sub-type of) the given type.
178      */

179     public boolean isSubtypeOf(String JavaDoc superType);
180 }
181
Popular Tags