Mercurial > projects > dwt-addons
comparison dwtx/jface/text/projection/ProjectionDocumentManager.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | c4fb132a086c |
children | b6bad70d540a |
comparison
equal
deleted
inserted
replaced
133:7d818bd32d63 | 134:51e6e63f930e |
---|---|
71 * | 71 * |
72 * @param master the master document | 72 * @param master the master document |
73 * @param projection the projection document | 73 * @param projection the projection document |
74 */ | 74 */ |
75 private void add(IDocument master, ProjectionDocument projection) { | 75 private void add(IDocument master, ProjectionDocument projection) { |
76 List list= (List) fProjectionRegistry.get(master); | 76 List list= cast(List) fProjectionRegistry.get(master); |
77 if (list is null) { | 77 if (list is null) { |
78 list= new ArrayList(1); | 78 list= new ArrayList(1); |
79 fProjectionRegistry.put(master, list); | 79 fProjectionRegistry.put(master, list); |
80 } | 80 } |
81 list.add(projection); | 81 list.add(projection); |
86 * | 86 * |
87 * @param master the master document | 87 * @param master the master document |
88 * @param projection the projection document | 88 * @param projection the projection document |
89 */ | 89 */ |
90 private void remove(IDocument master, ProjectionDocument projection) { | 90 private void remove(IDocument master, ProjectionDocument projection) { |
91 List list= (List) fProjectionRegistry.get(master); | 91 List list= cast(List) fProjectionRegistry.get(master); |
92 if (list !is null) { | 92 if (list !is null) { |
93 list.remove(projection); | 93 list.remove(projection); |
94 if (list.size() is 0) | 94 if (list.size() is 0) |
95 fProjectionRegistry.remove(master); | 95 fProjectionRegistry.remove(master); |
96 } | 96 } |
112 * | 112 * |
113 * @param master the document | 113 * @param master the document |
114 * @return an iterator for all registered projection documents or <code>null</code> | 114 * @return an iterator for all registered projection documents or <code>null</code> |
115 */ | 115 */ |
116 private Iterator getProjectionsIterator(IDocument master) { | 116 private Iterator getProjectionsIterator(IDocument master) { |
117 List list= (List) fProjectionRegistry.get(master); | 117 List list= cast(List) fProjectionRegistry.get(master); |
118 if (list !is null) | 118 if (list !is null) |
119 return list.iterator(); | 119 return list.iterator(); |
120 return null; | 120 return null; |
121 } | 121 } |
122 | 122 |
131 Iterator e= getProjectionsIterator(master); | 131 Iterator e= getProjectionsIterator(master); |
132 if (e is null) | 132 if (e is null) |
133 return; | 133 return; |
134 | 134 |
135 while (e.hasNext()) { | 135 while (e.hasNext()) { |
136 ProjectionDocument document= (ProjectionDocument) e.next(); | 136 ProjectionDocument document= cast(ProjectionDocument) e.next(); |
137 if (about) | 137 if (about) |
138 document.masterDocumentAboutToBeChanged(masterEvent); | 138 document.masterDocumentAboutToBeChanged(masterEvent); |
139 else | 139 else |
140 document.masterDocumentChanged(masterEvent); | 140 document.masterDocumentChanged(masterEvent); |
141 } | 141 } |
158 /* | 158 /* |
159 * @see dwtx.jface.text.ISlaveDocumentManager#createMasterSlaveMapping(dwtx.jface.text.IDocument) | 159 * @see dwtx.jface.text.ISlaveDocumentManager#createMasterSlaveMapping(dwtx.jface.text.IDocument) |
160 */ | 160 */ |
161 public IDocumentInformationMapping createMasterSlaveMapping(IDocument slave) { | 161 public IDocumentInformationMapping createMasterSlaveMapping(IDocument slave) { |
162 if (slave instanceof ProjectionDocument) { | 162 if (slave instanceof ProjectionDocument) { |
163 ProjectionDocument projectionDocument= (ProjectionDocument) slave; | 163 ProjectionDocument projectionDocument= cast(ProjectionDocument) slave; |
164 return projectionDocument.getDocumentInformationMapping(); | 164 return projectionDocument.getDocumentInformationMapping(); |
165 } | 165 } |
166 return null; | 166 return null; |
167 } | 167 } |
168 | 168 |
190 /* | 190 /* |
191 * @see dwtx.jface.text.ISlaveDocumentManager#freeSlaveDocument(dwtx.jface.text.IDocument) | 191 * @see dwtx.jface.text.ISlaveDocumentManager#freeSlaveDocument(dwtx.jface.text.IDocument) |
192 */ | 192 */ |
193 public void freeSlaveDocument(IDocument slave) { | 193 public void freeSlaveDocument(IDocument slave) { |
194 if (slave instanceof ProjectionDocument) { | 194 if (slave instanceof ProjectionDocument) { |
195 ProjectionDocument projectionDocument= (ProjectionDocument) slave; | 195 ProjectionDocument projectionDocument= cast(ProjectionDocument) slave; |
196 IDocument master= projectionDocument.getMasterDocument(); | 196 IDocument master= projectionDocument.getMasterDocument(); |
197 remove(master, projectionDocument); | 197 remove(master, projectionDocument); |
198 projectionDocument.dispose(); | 198 projectionDocument.dispose(); |
199 if (!hasProjection(master)) | 199 if (!hasProjection(master)) |
200 master.removeDocumentListener(this); | 200 master.removeDocumentListener(this); |
204 /* | 204 /* |
205 * @see dwtx.jface.text.ISlaveDocumentManager#getMasterDocument(dwtx.jface.text.IDocument) | 205 * @see dwtx.jface.text.ISlaveDocumentManager#getMasterDocument(dwtx.jface.text.IDocument) |
206 */ | 206 */ |
207 public IDocument getMasterDocument(IDocument slave) { | 207 public IDocument getMasterDocument(IDocument slave) { |
208 if (slave instanceof ProjectionDocument) | 208 if (slave instanceof ProjectionDocument) |
209 return ((ProjectionDocument) slave).getMasterDocument(); | 209 return (cast(ProjectionDocument) slave).getMasterDocument(); |
210 return null; | 210 return null; |
211 } | 211 } |
212 | 212 |
213 /* | 213 /* |
214 * @see dwtx.jface.text.ISlaveDocumentManager#isSlaveDocument(dwtx.jface.text.IDocument) | 214 * @see dwtx.jface.text.ISlaveDocumentManager#isSlaveDocument(dwtx.jface.text.IDocument) |
220 /* | 220 /* |
221 * @see dwtx.jface.text.ISlaveDocumentManager#setAutoExpandMode(dwtx.jface.text.IDocument, bool) | 221 * @see dwtx.jface.text.ISlaveDocumentManager#setAutoExpandMode(dwtx.jface.text.IDocument, bool) |
222 */ | 222 */ |
223 public void setAutoExpandMode(IDocument slave, bool autoExpanding) { | 223 public void setAutoExpandMode(IDocument slave, bool autoExpanding) { |
224 if (slave instanceof ProjectionDocument) | 224 if (slave instanceof ProjectionDocument) |
225 ((ProjectionDocument) slave).setAutoExpandMode(autoExpanding); | 225 (cast(ProjectionDocument) slave).setAutoExpandMode(autoExpanding); |
226 } | 226 } |
227 | 227 |
228 /* | 228 /* |
229 * @see dwtx.jface.text.ISlaveDocumentManagerExtension#getSlaveDocuments(dwtx.jface.text.IDocument) | 229 * @see dwtx.jface.text.ISlaveDocumentManagerExtension#getSlaveDocuments(dwtx.jface.text.IDocument) |
230 */ | 230 */ |
231 public IDocument[] getSlaveDocuments(IDocument master) { | 231 public IDocument[] getSlaveDocuments(IDocument master) { |
232 List list= (List) fProjectionRegistry.get(master); | 232 List list= cast(List) fProjectionRegistry.get(master); |
233 if (list !is null) { | 233 if (list !is null) { |
234 IDocument[] result= new IDocument[list.size()]; | 234 IDocument[] result= new IDocument[list.size()]; |
235 list.toArray(result); | 235 list.toArray(result); |
236 return result; | 236 return result; |
237 } | 237 } |