Mercurial > projects > dwt-addons
comparison dwtx/jface/text/source/projection/ProjectionSupport.d @ 138:b6bad70d540a
Regex instanceof changes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:26:23 +0200 |
parents | 51e6e63f930e |
children | 02cd5f1224d3 |
comparison
equal
deleted
inserted
replaced
137:25170b5a8951 | 138:b6bad70d540a |
---|---|
77 | 77 |
78 /* | 78 /* |
79 * @see dwtx.jface.text.source.AnnotationPainter#findAnnotationModel(dwtx.jface.text.source.ISourceViewer) | 79 * @see dwtx.jface.text.source.AnnotationPainter#findAnnotationModel(dwtx.jface.text.source.ISourceViewer) |
80 */ | 80 */ |
81 protected IAnnotationModel findAnnotationModel(ISourceViewer sourceViewer) { | 81 protected IAnnotationModel findAnnotationModel(ISourceViewer sourceViewer) { |
82 if (sourceViewer instanceof ProjectionViewer) { | 82 if ( cast(ProjectionViewer)sourceViewer ) { |
83 ProjectionViewer projectionViewer= cast(ProjectionViewer) sourceViewer; | 83 ProjectionViewer projectionViewer= cast(ProjectionViewer) sourceViewer; |
84 return projectionViewer.getProjectionAnnotationModel(); | 84 return projectionViewer.getProjectionAnnotationModel(); |
85 } | 85 } |
86 return null; | 86 return null; |
87 } | 87 } |
88 | 88 |
89 /* | 89 /* |
90 * @see dwtx.jface.text.source.AnnotationPainter#skip(dwtx.jface.text.source.Annotation) | 90 * @see dwtx.jface.text.source.AnnotationPainter#skip(dwtx.jface.text.source.Annotation) |
91 */ | 91 */ |
92 protected bool skip(Annotation annotation) { | 92 protected bool skip(Annotation annotation) { |
93 if (annotation instanceof ProjectionAnnotation) | 93 if ( cast(ProjectionAnnotation)annotation ) |
94 return !(cast(ProjectionAnnotation) annotation).isCollapsed(); | 94 return !(cast(ProjectionAnnotation) annotation).isCollapsed(); |
95 | 95 |
96 return super.skip(annotation); | 96 return super.skip(annotation); |
97 } | 97 } |
98 } | 98 } |
100 private static class ProjectionDrawingStrategy : AnnotationPainter.IDrawingStrategy { | 100 private static class ProjectionDrawingStrategy : AnnotationPainter.IDrawingStrategy { |
101 /* | 101 /* |
102 * @see dwtx.jface.text.source.AnnotationPainter.IDrawingStrategy#draw(dwt.graphics.GC, dwt.custom.StyledText, int, int, dwt.graphics.Color) | 102 * @see dwtx.jface.text.source.AnnotationPainter.IDrawingStrategy#draw(dwt.graphics.GC, dwt.custom.StyledText, int, int, dwt.graphics.Color) |
103 */ | 103 */ |
104 public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { | 104 public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { |
105 if (annotation instanceof ProjectionAnnotation) { | 105 if ( cast(ProjectionAnnotation)annotation ) { |
106 ProjectionAnnotation projectionAnnotation= cast(ProjectionAnnotation) annotation; | 106 ProjectionAnnotation projectionAnnotation= cast(ProjectionAnnotation) annotation; |
107 if (projectionAnnotation.isCollapsed()) { | 107 if (projectionAnnotation.isCollapsed()) { |
108 | 108 |
109 if (gc !is null) { | 109 if (gc !is null) { |
110 | 110 |
371 * @return the adapter or <code>null</code> | 371 * @return the adapter or <code>null</code> |
372 * | 372 * |
373 */ | 373 */ |
374 public Object getAdapter(ISourceViewer viewer, Class required) { | 374 public Object getAdapter(ISourceViewer viewer, Class required) { |
375 if (ProjectionAnnotationModel.class.equals(required)) { | 375 if (ProjectionAnnotationModel.class.equals(required)) { |
376 if (viewer instanceof ProjectionViewer) { | 376 if ( cast(ProjectionViewer)viewer ) { |
377 ProjectionViewer projectionViewer= cast(ProjectionViewer) viewer; | 377 ProjectionViewer projectionViewer= cast(ProjectionViewer) viewer; |
378 return projectionViewer.getProjectionAnnotationModel(); | 378 return projectionViewer.getProjectionAnnotationModel(); |
379 } | 379 } |
380 } | 380 } |
381 return null; | 381 return null; |