Mercurial > projects > dwt-addons
comparison dwtx/jface/text/link/LinkedModeManager.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 | 25170b5a8951 |
comparison
equal
deleted
inserted
replaced
133:7d818bd32d63 | 134:51e6e63f930e |
---|---|
115 return null; | 115 return null; |
116 | 116 |
117 Set mgrs= new HashSet(); | 117 Set mgrs= new HashSet(); |
118 LinkedModeManager mgr= null; | 118 LinkedModeManager mgr= null; |
119 for (int i= 0; i < documents.length; i++) { | 119 for (int i= 0; i < documents.length; i++) { |
120 mgr= (LinkedModeManager) fgManagers.get(documents[i]); | 120 mgr= cast(LinkedModeManager) fgManagers.get(documents[i]); |
121 if (mgr !is null) | 121 if (mgr !is null) |
122 mgrs.add(mgr); | 122 mgrs.add(mgr); |
123 } | 123 } |
124 if (mgrs.size() > 1) | 124 if (mgrs.size() > 1) |
125 if (force) { | 125 if (force) { |
126 for (Iterator it= mgrs.iterator(); it.hasNext(); ) { | 126 for (Iterator it= mgrs.iterator(); it.hasNext(); ) { |
127 LinkedModeManager m= (LinkedModeManager) it.next(); | 127 LinkedModeManager m= cast(LinkedModeManager) it.next(); |
128 m.closeAllEnvironments(); | 128 m.closeAllEnvironments(); |
129 } | 129 } |
130 } else { | 130 } else { |
131 return null; | 131 return null; |
132 } | 132 } |
144 * Cancels any linked mode manager for the specified document. | 144 * Cancels any linked mode manager for the specified document. |
145 * | 145 * |
146 * @param document the document whose <code>LinkedModeManager</code> should be canceled | 146 * @param document the document whose <code>LinkedModeManager</code> should be canceled |
147 */ | 147 */ |
148 public static void cancelManager(IDocument document) { | 148 public static void cancelManager(IDocument document) { |
149 LinkedModeManager mgr= (LinkedModeManager) fgManagers.get(document); | 149 LinkedModeManager mgr= cast(LinkedModeManager) fgManagers.get(document); |
150 if (mgr !is null) | 150 if (mgr !is null) |
151 mgr.closeAllEnvironments(); | 151 mgr.closeAllEnvironments(); |
152 } | 152 } |
153 | 153 |
154 /** The hierarchy of environments managed by this manager. */ | 154 /** The hierarchy of environments managed by this manager. */ |
164 private void left(LinkedModeModel model, int flags) { | 164 private void left(LinkedModeModel model, int flags) { |
165 if (!fEnvironments.contains(model)) | 165 if (!fEnvironments.contains(model)) |
166 return; | 166 return; |
167 | 167 |
168 while (!fEnvironments.isEmpty()) { | 168 while (!fEnvironments.isEmpty()) { |
169 LinkedModeModel env= (LinkedModeModel) fEnvironments.pop(); | 169 LinkedModeModel env= cast(LinkedModeModel) fEnvironments.pop(); |
170 if (env is model) | 170 if (env is model) |
171 break; | 171 break; |
172 env.exit(ILinkedModeListener.NONE); | 172 env.exit(ILinkedModeListener.NONE); |
173 } | 173 } |
174 | 174 |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 private void closeAllEnvironments() { | 180 private void closeAllEnvironments() { |
181 while (!fEnvironments.isEmpty()) { | 181 while (!fEnvironments.isEmpty()) { |
182 LinkedModeModel env= (LinkedModeModel) fEnvironments.pop(); | 182 LinkedModeModel env= cast(LinkedModeModel) fEnvironments.pop(); |
183 env.exit(ILinkedModeListener.NONE); | 183 env.exit(ILinkedModeListener.NONE); |
184 } | 184 } |
185 | 185 |
186 removeManager(); | 186 removeManager(); |
187 } | 187 } |
188 | 188 |
189 private void removeManager() { | 189 private void removeManager() { |
190 for (Iterator it= fgManagers.keySet().iterator(); it.hasNext();) { | 190 for (Iterator it= fgManagers.keySet().iterator(); it.hasNext();) { |
191 IDocument doc= (IDocument) it.next(); | 191 IDocument doc= cast(IDocument) it.next(); |
192 if (fgManagers.get(doc) is this) | 192 if (fgManagers.get(doc) is this) |
193 it.remove(); | 193 it.remove(); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
213 model.addLinkingListener(fListener); | 213 model.addLinkingListener(fListener); |
214 fEnvironments.push(model); | 214 fEnvironments.push(model); |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
218 LinkedModeModel top= (LinkedModeModel) fEnvironments.peek(); | 218 LinkedModeModel top= cast(LinkedModeModel) fEnvironments.peek(); |
219 if (model.canNestInto(top)) { | 219 if (model.canNestInto(top)) { |
220 model.addLinkingListener(fListener); | 220 model.addLinkingListener(fListener); |
221 fEnvironments.push(model); | 221 fEnvironments.push(model); |
222 return true; | 222 return true; |
223 } else if (!force) { | 223 } else if (!force) { |
241 * @return the topmost <code>LinkedModeModel</code> | 241 * @return the topmost <code>LinkedModeModel</code> |
242 */ | 242 */ |
243 public LinkedModeModel getTopEnvironment() { | 243 public LinkedModeModel getTopEnvironment() { |
244 if (fEnvironments.isEmpty()) | 244 if (fEnvironments.isEmpty()) |
245 return null; | 245 return null; |
246 return (LinkedModeModel) fEnvironments.peek(); | 246 return cast(LinkedModeModel) fEnvironments.peek(); |
247 } | 247 } |
248 } | 248 } |