Mercurial > projects > dwt-addons
comparison dwtx/jface/text/source/CompositeRuler.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | f70d9508c95c |
children | 1a5b8f8129df |
comparison
equal
deleted
inserted
replaced
157:7f75eaa8103a | 158:25f1f92fa3df |
---|---|
72 import dwtx.jface.text.source.AnnotationPainter; // packageimport | 72 import dwtx.jface.text.source.AnnotationPainter; // packageimport |
73 import dwtx.jface.text.source.IAnnotationHoverExtension2; // packageimport | 73 import dwtx.jface.text.source.IAnnotationHoverExtension2; // packageimport |
74 import dwtx.jface.text.source.OverviewRuler; // packageimport | 74 import dwtx.jface.text.source.OverviewRuler; // packageimport |
75 import dwtx.jface.text.source.OverviewRulerHoverManager; // packageimport | 75 import dwtx.jface.text.source.OverviewRulerHoverManager; // packageimport |
76 | 76 |
77 | |
78 import dwt.dwthelper.utils; | 77 import dwt.dwthelper.utils; |
79 | |
80 | |
81 import dwtx.dwtxhelper.Collection; | 78 import dwtx.dwtxhelper.Collection; |
82 import java.util.EventListener; | |
83 | |
84 | |
85 | |
86 | |
87 | 79 |
88 import dwt.DWT; | 80 import dwt.DWT; |
89 import dwt.custom.StyledText; | 81 import dwt.custom.StyledText; |
90 import dwt.events.ControlListener; | 82 import dwt.events.ControlListener; |
91 import dwt.events.DisposeEvent; | 83 import dwt.events.DisposeEvent; |
188 | 180 |
189 /** | 181 /** |
190 * Keeps the information for which event type a listener object has been added. | 182 * Keeps the information for which event type a listener object has been added. |
191 */ | 183 */ |
192 static class ListenerInfo { | 184 static class ListenerInfo { |
193 Class fClass; | 185 ClassInfo fClass; |
194 EventListener fListener; | 186 EventListener fListener; |
195 } | 187 } |
196 | 188 |
197 /** The list of listeners added to this canvas. */ | 189 /** The list of listeners added to this canvas. */ |
198 private List fCachedListeners= new ArrayList(); | 190 private List fCachedListeners= new ArrayList(); |
237 * | 229 * |
238 * @param clazz the listener type | 230 * @param clazz the listener type |
239 * @param control the control to add the listener to | 231 * @param control the control to add the listener to |
240 * @param listener the listener to be added | 232 * @param listener the listener to be added |
241 */ | 233 */ |
242 private void addListener(Class clazz, Control control, EventListener listener) { | 234 private void addListener(ClassInfo clazz, Control control, EventListener listener) { |
243 if (ControlListener.classinfo.opEquals(clazz)) { | 235 if (ControlListener.classinfo.opEquals(clazz)) { |
244 control. addControlListener(cast(ControlListener) listener); | 236 control. addControlListener(cast(ControlListener) listener); |
245 return; | 237 return; |
246 } | 238 } |
247 if (FocusListener.classinfo.opEquals(clazz)) { | 239 if (FocusListener.classinfo.opEquals(clazz)) { |
288 * | 280 * |
289 * @param clazz the listener type | 281 * @param clazz the listener type |
290 * @param control the control to remove the listener from | 282 * @param control the control to remove the listener from |
291 * @param listener the listener to be removed | 283 * @param listener the listener to be removed |
292 */ | 284 */ |
293 private void removeListener(Class clazz, Control control, EventListener listener) { | 285 private void removeListener(ClassInfo clazz, Control control, EventListener listener) { |
294 if (ControlListener.classinfo.opEquals(clazz)) { | 286 if (ControlListener.classinfo.opEquals(clazz)) { |
295 control. removeControlListener(cast(ControlListener) listener); | 287 control. removeControlListener(cast(ControlListener) listener); |
296 return; | 288 return; |
297 } | 289 } |
298 if (FocusListener.classinfo.opEquals(clazz)) { | 290 if (FocusListener.classinfo.opEquals(clazz)) { |
338 * the given listener type (<code>clazz</code>). | 330 * the given listener type (<code>clazz</code>). |
339 * | 331 * |
340 * @param clazz the listener type | 332 * @param clazz the listener type |
341 * @param listener the listener object | 333 * @param listener the listener object |
342 */ | 334 */ |
343 private void addListener(Class clazz, EventListener listener) { | 335 private void addListener(ClassInfo clazz, EventListener listener) { |
344 Control[] children= getChildren(); | 336 Control[] children= getChildren(); |
345 for (int i= 0; i < children.length; i++) { | 337 for (int i= 0; i < children.length; i++) { |
346 if (children[i] !is null && !children[i].isDisposed()) | 338 if (children[i] !is null && !children[i].isDisposed()) |
347 addListener(clazz, children[i], listener); | 339 addListener(clazz, children[i], listener); |
348 } | 340 } |
358 * the given listener type (<code>clazz</code>). | 350 * the given listener type (<code>clazz</code>). |
359 * | 351 * |
360 * @param clazz the listener type | 352 * @param clazz the listener type |
361 * @param listener the listener object | 353 * @param listener the listener object |
362 */ | 354 */ |
363 private void removeListener(Class clazz, EventListener listener) { | 355 private void removeListener(ClassInfo clazz, EventListener listener) { |
364 int length= fCachedListeners.size(); | 356 int length= fCachedListeners.size(); |
365 for (int i= 0; i < length; i++) { | 357 for (int i= 0; i < length; i++) { |
366 ListenerInfo info= cast(ListenerInfo) fCachedListeners.get(i); | 358 ListenerInfo info= cast(ListenerInfo) fCachedListeners.get(i); |
367 if (listener is info.fListener && clazz.equals(info.fClass)) { | 359 if (listener is info.fListener && clazz.equals(info.fClass)) { |
368 fCachedListeners.remove(i); | 360 fCachedListeners.remove(i); |