KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > source > IAnnotationModelExtension


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.jface.text.source;
12
13
14 import java.util.Map JavaDoc;
15
16 import org.eclipse.jface.text.Position;
17
18
19 /**
20  * Extends {@link org.eclipse.jface.text.source.IAnnotationModel}with the
21  * ability piggyback other annotation models. It also introduces the concept of
22  * modification time stamps and adds methods for richer manipulation methods.
23  *
24  * @since 3.0
25  */

26 public interface IAnnotationModelExtension {
27
28     /**
29      * Attaches <code>attachment</code> to the receiver. Connects
30      * <code>attachment</code> to the currently connected document. If
31      * <code>attachment</code> is already attached (even) under a different
32      * key), it is not attached again.
33      *
34      * @param key the key through which the attachment is identified.
35      * @param attachment the attached <code>IAnnotationModel</code>
36      */

37     void addAnnotationModel(Object JavaDoc key, IAnnotationModel attachment);
38
39     /**
40      * Returns the attached <code>IAnnotationModel</code> for <code>key</code>,
41      * or <code>null</code> if none is attached for <code>key</code>.
42      *
43      * @param key the key through which the attachment is identified.
44      * @return an <code>IAnnotationModel</code> attached under
45      * <code>key</code>, or <code>null</code>
46      */

47     IAnnotationModel getAnnotationModel(Object JavaDoc key);
48
49     /**
50      * Removes and returns the attached <code>IAnnotationModel</code> for
51      * <code>key</code>.
52      *
53      * @param key the key through which the attachment is identified.
54      * @return an <code>IAnnotationModel</code> attached under
55      * <code>key</code>, or <code>null</code>
56      */

57     IAnnotationModel removeAnnotationModel(Object JavaDoc key);
58
59     /**
60      * Adds and removes annotations to/from this annotation model in a single
61      * step. The annotations to remove are given in an array. The annotations to
62      * add are provided in a map associating the annotations with the positions
63      * at which they should be added. All registered annotation model listeners
64      * are informed about the change. If the model is connected to a document,
65      * the positions are automatically updated on document changes. Annotations
66      * that are already managed by this annotation model or are not associated
67      * with a valid position in the connected document have no effect.
68      *
69      * @param annotationsToRemove the annotations to be removed, may be
70      * <code>null</code>
71      * @param annotationsToAdd the annotations which will be added, may be
72      * <code>null</code> each map entry has an
73      * <code>Annotation</code> as key and a <code>Position</code>
74      * as value
75      * @throws ClassCastException if one of the map key or values has a wrong
76      * type
77      */

78     void replaceAnnotations(Annotation[] annotationsToRemove, Map JavaDoc annotationsToAdd) throws ClassCastException JavaDoc;
79
80     /**
81      * Modifies the position associated with the given annotation to equal the
82      * given position. If the annotation is not yet managed by this annotation
83      * model, the annotation is added. If the given position is
84      * <code>null</code> the annotation is removed from the model. All
85      * annotation model change listeners will be informed about the change.
86      *
87      * @param annotation the annotation whose associated position should be
88      * modified
89      * @param position the position to whose values the associated position
90      * should be changed
91      */

92     void modifyAnnotationPosition(Annotation annotation, Position position);
93
94     /**
95      * Removes all annotations from this annotation model.
96      */

97     void removeAllAnnotations();
98
99     /**
100      * Returns the modification stamp of this annotation model.
101      *
102      * @return the modification stamp of this annotation model
103      */

104     Object JavaDoc getModificationStamp();
105 }
106
Popular Tags