Mercurial > projects > dwt-addons
comparison dwtx/jface/text/source/IAnnotationModelExtension.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.text.source.IAnnotationModelExtension; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 | |
18 import java.util.Map; | |
19 | |
20 import dwtx.jface.text.Position; | |
21 | |
22 | |
23 /** | |
24 * Extends {@link dwtx.jface.text.source.IAnnotationModel}with the | |
25 * ability piggyback other annotation models. It also introduces the concept of | |
26 * modification time stamps and adds methods for richer manipulation methods. | |
27 * | |
28 * @since 3.0 | |
29 */ | |
30 public interface IAnnotationModelExtension { | |
31 | |
32 /** | |
33 * Attaches <code>attachment</code> to the receiver. Connects | |
34 * <code>attachment</code> to the currently connected document. If | |
35 * <code>attachment</code> is already attached (even) under a different | |
36 * key), it is not attached again. | |
37 * | |
38 * @param key the key through which the attachment is identified. | |
39 * @param attachment the attached <code>IAnnotationModel</code> | |
40 */ | |
41 void addAnnotationModel(Object key, IAnnotationModel attachment); | |
42 | |
43 /** | |
44 * Returns the attached <code>IAnnotationModel</code> for <code>key</code>, | |
45 * or <code>null</code> if none is attached for <code>key</code>. | |
46 * | |
47 * @param key the key through which the attachment is identified. | |
48 * @return an <code>IAnnotationModel</code> attached under | |
49 * <code>key</code>, or <code>null</code> | |
50 */ | |
51 IAnnotationModel getAnnotationModel(Object key); | |
52 | |
53 /** | |
54 * Removes and returns the attached <code>IAnnotationModel</code> for | |
55 * <code>key</code>. | |
56 * | |
57 * @param key the key through which the attachment is identified. | |
58 * @return an <code>IAnnotationModel</code> attached under | |
59 * <code>key</code>, or <code>null</code> | |
60 */ | |
61 IAnnotationModel removeAnnotationModel(Object key); | |
62 | |
63 /** | |
64 * Adds and removes annotations to/from this annotation model in a single | |
65 * step. The annotations to remove are given in an array. The annotations to | |
66 * add are provided in a map associating the annotations with the positions | |
67 * at which they should be added. All registered annotation model listeners | |
68 * are informed about the change. If the model is connected to a document, | |
69 * the positions are automatically updated on document changes. Annotations | |
70 * that are already managed by this annotation model or are not associated | |
71 * with a valid position in the connected document have no effect. | |
72 * | |
73 * @param annotationsToRemove the annotations to be removed, may be | |
74 * <code>null</code> | |
75 * @param annotationsToAdd the annotations which will be added, may be | |
76 * <code>null</code> each map entry has an | |
77 * <code>Annotation</code> as key and a <code>Position</code> | |
78 * as value | |
79 * @throws ClassCastException if one of the map key or values has a wrong | |
80 * type | |
81 */ | |
82 void replaceAnnotations(Annotation[] annotationsToRemove, Map annotationsToAdd) throws ClassCastException; | |
83 | |
84 /** | |
85 * Modifies the position associated with the given annotation to equal the | |
86 * given position. If the annotation is not yet managed by this annotation | |
87 * model, the annotation is added. If the given position is | |
88 * <code>null</code> the annotation is removed from the model. All | |
89 * annotation model change listeners will be informed about the change. | |
90 * | |
91 * @param annotation the annotation whose associated position should be | |
92 * modified | |
93 * @param position the position to whose values the associated position | |
94 * should be changed | |
95 */ | |
96 void modifyAnnotationPosition(Annotation annotation, Position position); | |
97 | |
98 /** | |
99 * Removes all annotations from this annotation model. | |
100 */ | |
101 void removeAllAnnotations(); | |
102 | |
103 /** | |
104 * Returns the modification stamp of this annotation model. | |
105 * | |
106 * @return the modification stamp of this annotation model | |
107 */ | |
108 Object getModificationStamp(); | |
109 } |