comparison dwtx/jface/text/source/OverviewRuler.d @ 159:7926b636c282

...
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 01:57:58 +0200
parents f70d9508c95c
children 1a5b8f8129df
comparison
equal deleted inserted replaced
158:25f1f92fa3df 159:7926b636c282
366 /** The ruler's header */ 366 /** The ruler's header */
367 private Canvas fHeader; 367 private Canvas fHeader;
368 /** The buffer for double buffering */ 368 /** The buffer for double buffering */
369 private Image fBuffer; 369 private Image fBuffer;
370 /** The internal listener */ 370 /** The internal listener */
371 private InternalListener fInternalListener= new InternalListener(); 371 private InternalListener fInternalListener;
372 /** The width of this vertical ruler */ 372 /** The width of this vertical ruler */
373 private int fWidth; 373 private int fWidth;
374 /** The hit detection cursor */ 374 /** The hit detection cursor */
375 private Cursor fHitDetectionCursor; 375 private Cursor fHitDetectionCursor;
376 /** The last cursor */ 376 /** The last cursor */
385 private HeaderPainter fHeaderPainter; 385 private HeaderPainter fHeaderPainter;
386 /** 386 /**
387 * The list of annotation types to be shown in this ruler. 387 * The list of annotation types to be shown in this ruler.
388 * @since 3.0 388 * @since 3.0
389 */ 389 */
390 private Set fConfiguredAnnotationTypes= new HashSet(); 390 private Set fConfiguredAnnotationTypes;
391 /** 391 /**
392 * The list of annotation types to be shown in the header of this ruler. 392 * The list of annotation types to be shown in the header of this ruler.
393 * @since 3.0 393 * @since 3.0
394 */ 394 */
395 private Set fConfiguredHeaderAnnotationTypes= new HashSet(); 395 private Set fConfiguredHeaderAnnotationTypes;
396 /** The mapping between annotation types and colors */ 396 /** The mapping between annotation types and colors */
397 private Map fAnnotationTypes2Colors= new HashMap(); 397 private Map fAnnotationTypes2Colors;
398 /** The color manager */ 398 /** The color manager */
399 private ISharedTextColors fSharedTextColors; 399 private ISharedTextColors fSharedTextColors;
400 /** 400 /**
401 * All available annotation types sorted by layer. 401 * All available annotation types sorted by layer.
402 * 402 *
403 * @since 3.0 403 * @since 3.0
404 */ 404 */
405 private List fAnnotationsSortedByLayer= new ArrayList(); 405 private List fAnnotationsSortedByLayer;
406 /** 406 /**
407 * All available layers sorted by layer. 407 * All available layers sorted by layer.
408 * This list may contain duplicates. 408 * This list may contain duplicates.
409 * @since 3.0 409 * @since 3.0
410 */ 410 */
411 private List fLayersSortedByLayer= new ArrayList(); 411 private List fLayersSortedByLayer;
412 /** 412 /**
413 * Map of allowed annotation types. 413 * Map of allowed annotation types.
414 * An allowed annotation type maps to <code>true</code>, a disallowed 414 * An allowed annotation type maps to <code>true</code>, a disallowed
415 * to <code>false</code>. 415 * to <code>false</code>.
416 * @since 3.0 416 * @since 3.0
417 */ 417 */
418 private Map fAllowedAnnotationTypes= new HashMap(); 418 private Map fAllowedAnnotationTypes;
419 /** 419 /**
420 * Map of allowed header annotation types. 420 * Map of allowed header annotation types.
421 * An allowed annotation type maps to <code>true</code>, a disallowed 421 * An allowed annotation type maps to <code>true</code>, a disallowed
422 * to <code>false</code>. 422 * to <code>false</code>.
423 * @since 3.0 423 * @since 3.0
424 */ 424 */
425 private Map fAllowedHeaderAnnotationTypes= new HashMap(); 425 private Map fAllowedHeaderAnnotationTypes;
426 /** 426 /**
427 * The cached annotations. 427 * The cached annotations.
428 * @since 3.0 428 * @since 3.0
429 */ 429 */
430 private List fCachedAnnotations= new ArrayList(); 430 private List fCachedAnnotations;
431 431
432 /** 432 /**
433 * Redraw runnable lock 433 * Redraw runnable lock
434 * @since 3.3 434 * @since 3.3
435 */ 435 */
436 private Object fRunnableLock= new Object(); 436 private Object fRunnableLock;
437 /** 437 /**
438 * Redraw runnable state 438 * Redraw runnable state
439 * @since 3.3 439 * @since 3.3
440 */ 440 */
441 private bool fIsRunnablePosted= false; 441 private bool fIsRunnablePosted= false;
442 /** 442 /**
443 * Redraw runnable 443 * Redraw runnable
444 * @since 3.3 444 * @since 3.3
445 */ 445 */
446 private Runnable fRunnable= new class() Runnable { 446 private Runnable fRunnable;
447 public void run() {
448 synchronized (fRunnableLock) {
449 fIsRunnablePosted= false;
450 }
451 redraw();
452 updateHeader();
453 }
454 };
455 /** 447 /**
456 * Tells whether temporary annotations are drawn with 448 * Tells whether temporary annotations are drawn with
457 * a separate color. This color will be computed by 449 * a separate color. This color will be computed by
458 * discoloring the original annotation color. 450 * discoloring the original annotation color.
459 * 451 *
486 * @param sharedColors the color manager 478 * @param sharedColors the color manager
487 * @param discolorTemporaryAnnotation <code>true</code> if temporary annotations should be discolored 479 * @param discolorTemporaryAnnotation <code>true</code> if temporary annotations should be discolored
488 * @since 3.4 480 * @since 3.4
489 */ 481 */
490 public this(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors, bool discolorTemporaryAnnotation) { 482 public this(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors, bool discolorTemporaryAnnotation) {
483 // DWT instance init
484 fInternalListener= new InternalListener();
485 fConfiguredAnnotationTypes= new HashSet();
486 fConfiguredHeaderAnnotationTypes= new HashSet();
487 fAnnotationTypes2Colors= new HashMap();
488 fAnnotationsSortedByLayer= new ArrayList();
489 fLayersSortedByLayer= new ArrayList();
490 fAllowedAnnotationTypes= new HashMap();
491 fAllowedHeaderAnnotationTypes= new HashMap();
492 fCachedAnnotations= new ArrayList();
493 fRunnableLock= new Object();
494 fRunnable= dgRunnable( {
495 synchronized (fRunnableLock) {
496 fIsRunnablePosted= false;
497 }
498 redraw();
499 updateHeader();
500 });
501
491 fAnnotationAccess= annotationAccess; 502 fAnnotationAccess= annotationAccess;
492 fWidth= width; 503 fWidth= width;
493 fSharedTextColors= sharedColors; 504 fSharedTextColors= sharedColors;
494 fIsTemporaryAnnotationDiscolored= discolorTemporaryAnnotation; 505 fIsTemporaryAnnotationDiscolored= discolorTemporaryAnnotation;
495 } 506 }