comparison dwtx/jface/text/link/LinkedPositionAnnotations.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents f70d9508c95c
children
comparison
equal deleted inserted replaced
161:f8d52b926852 162:1a5b8f8129df
58 private bool fMarkFocus= true; 58 private bool fMarkFocus= true;
59 private bool fMarkExitTarget= true; 59 private bool fMarkExitTarget= true;
60 60
61 private Annotation fFocusAnnotation= null; 61 private Annotation fFocusAnnotation= null;
62 private Annotation fExitAnnotation= null; 62 private Annotation fExitAnnotation= null;
63 private const Map fGroupAnnotations= new HashMap(); 63 private const Map fGroupAnnotations;
64 private const Map fTargetAnnotations= new HashMap(); 64 private const Map fTargetAnnotations;
65 private Position[] fTargets= new Position[0]; 65 private Position[] fTargets;
66 private LinkedPosition fExitPosition= null; 66 private LinkedPosition fExitPosition= null;
67
68 public this(){
69 fGroupAnnotations= new HashMap();
70 fTargetAnnotations= new HashMap();
71 }
67 72
68 /** 73 /**
69 * Sets the position that should be highlighted as the focus position, i.e. 74 * Sets the position that should be highlighted as the focus position, i.e.
70 * as the position whose changes are propagated to all its linked positions 75 * as the position whose changes are propagated to all its linked positions
71 * by the linked environment. 76 * by the linked environment.
132 } 137 }
133 } 138 }
134 } 139 }
135 fGroupAnnotations.values().removeAll(toRemove); 140 fGroupAnnotations.values().removeAll(toRemove);
136 141
137 replaceAnnotations((Annotation[]) toRemove.toArray(new Annotation[0]), toAdd, false); 142 replaceAnnotations(arraycast!(Annotation)( toRemove.toArray()), toAdd, false);
138 } 143 }
139 144
140 /** 145 /**
141 * Sets the positions that should be highlighted as the target positions, i.e. 146 * Sets the positions that should be highlighted as the target positions, i.e.
142 * as the positions that can be jumped to in a linked set up. 147 * as the positions that can be jumped to in a linked set up.
166 } 171 }
167 } 172 }
168 } 173 }
169 fTargetAnnotations.values().removeAll(toRemove); 174 fTargetAnnotations.values().removeAll(toRemove);
170 175
171 replaceAnnotations((Annotation[]) toRemove.toArray(new Annotation[0]), toAdd, false); 176 replaceAnnotations(arraycast!(Annotation)( toRemove.toArray()), toAdd, false);
172 } 177 }
173 178
174 /** 179 /**
175 * Switches the focus position to <code>position</code> given the 180 * Switches the focus position to <code>position</code> given the
176 * <code>LinkedModeModel env</code>. The slave positions for <code>position</code> 181 * <code>LinkedModeModel env</code>. The slave positions for <code>position</code>
197 if (linkedGroup !is null) 202 if (linkedGroup !is null)
198 group= new ArrayList(Arrays.asList(linkedGroup.getPositions())); 203 group= new ArrayList(Arrays.asList(linkedGroup.getPositions()));
199 else 204 else
200 group= new ArrayList(); 205 group= new ArrayList();
201 206
202 if (position is null || !fDocument.equals(position.getDocument())) 207 if (position is null || !(cast(Object)fDocument).opEquals(cast(Object)position.getDocument()))
203 // position is not valid if not in this document 208 // position is not valid if not in this document
204 position= null; 209 position= null;
205 210
206 LinkedPosition exit= fExitPosition; 211 LinkedPosition exit= fExitPosition;
207 if (exit is null || !fDocument.equals(exit.getDocument())) 212 if (exit is null || !(cast(Object)fDocument).opEquals(cast(Object)exit.getDocument()))
208 // position is not valid if not in this document 213 // position is not valid if not in this document
209 exit= null; 214 exit= null;
210 215
211 216
212 if (exit !is null) { 217 if (exit !is null) {
241 * @param list the list of positions to prune 246 * @param list the list of positions to prune
242 */ 247 */
243 private void prune(List list) { 248 private void prune(List list) {
244 for (Iterator iter= list.iterator(); iter.hasNext();) { 249 for (Iterator iter= list.iterator(); iter.hasNext();) {
245 LinkedPosition pos= cast(LinkedPosition) iter.next(); 250 LinkedPosition pos= cast(LinkedPosition) iter.next();
246 if (!pos.getDocument().equals(fDocument)) 251 if (!(cast(Object)pos.getDocument()).opEquals(cast(Object)fDocument))
247 iter.remove(); 252 iter.remove();
248 } 253 }
249 } 254 }
250 255
251 /** 256 /**