Mercurial > projects > dwt-addons
comparison dwtx/jface/text/source/AnnotationPainter.d @ 138:b6bad70d540a
Regex instanceof changes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:26:23 +0200 |
parents | 65801ad2b265 |
children | 26688fec6d23 |
comparison
equal
deleted
inserted
replaced
137:25170b5a8951 | 138:b6bad70d540a |
---|---|
910 if (decoration is null) | 910 if (decoration is null) |
911 decoration= new Decoration(); | 911 decoration= new Decoration(); |
912 | 912 |
913 decoration.fPosition= position; | 913 decoration.fPosition= position; |
914 decoration.fColor= color; | 914 decoration.fColor= color; |
915 if (fAnnotationAccess instanceof IAnnotationAccessExtension) { | 915 if ( cast(IAnnotationAccessExtension)fAnnotationAccess ) { |
916 IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; | 916 IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; |
917 decoration.fLayer= extension.getLayer(annotation); | 917 decoration.fLayer= extension.getLayer(annotation); |
918 } else { | 918 } else { |
919 decoration.fLayer= IAnnotationAccessExtension.DEFAULT_LAYER; | 919 decoration.fLayer= IAnnotationAccessExtension.DEFAULT_LAYER; |
920 } | 920 } |
940 if (strategy !is null) { | 940 if (strategy !is null) { |
941 fCachedAnnotationType2PaintingStrategy.put(type, strategy); | 941 fCachedAnnotationType2PaintingStrategy.put(type, strategy); |
942 return strategy; | 942 return strategy; |
943 } | 943 } |
944 | 944 |
945 if (fAnnotationAccess instanceof IAnnotationAccessExtension) { | 945 if ( cast(IAnnotationAccessExtension)fAnnotationAccess ) { |
946 IAnnotationAccessExtension ext = cast(IAnnotationAccessExtension) fAnnotationAccess; | 946 IAnnotationAccessExtension ext = cast(IAnnotationAccessExtension) fAnnotationAccess; |
947 Object[] sts = ext.getSupertypes(type); | 947 Object[] sts = ext.getSupertypes(type); |
948 for (int i= 0; i < sts.length; i++) { | 948 for (int i= 0; i < sts.length; i++) { |
949 strategy= fPaintingStrategyId2PaintingStrategy.get(fAnnotationType2PaintingStrategyId.get(sts[i])); | 949 strategy= fPaintingStrategyId2PaintingStrategy.get(fAnnotationType2PaintingStrategyId.get(sts[i])); |
950 if (strategy !is null) { | 950 if (strategy !is null) { |
975 if (color !is null) { | 975 if (color !is null) { |
976 fCachedAnnotationType2Color.put(annotationType, color); | 976 fCachedAnnotationType2Color.put(annotationType, color); |
977 return color; | 977 return color; |
978 } | 978 } |
979 | 979 |
980 if (fAnnotationAccess instanceof IAnnotationAccessExtension) { | 980 if ( cast(IAnnotationAccessExtension)fAnnotationAccess ) { |
981 IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; | 981 IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; |
982 Object[] superTypes= extension.getSupertypes(annotationType); | 982 Object[] superTypes= extension.getSupertypes(annotationType); |
983 if (superTypes !is null) { | 983 if (superTypes !is null) { |
984 for (int i= 0; i < superTypes.length; i++) { | 984 for (int i= 0; i < superTypes.length; i++) { |
985 color= cast(Color)fAnnotationType2Color.get(superTypes[i]); | 985 color= cast(Color)fAnnotationType2Color.get(superTypes[i]); |
1018 r= new Region(fCurrentHighlightAnnotationRange.getOffset(), fCurrentHighlightAnnotationRange.getLength()); | 1018 r= new Region(fCurrentHighlightAnnotationRange.getOffset(), fCurrentHighlightAnnotationRange.getLength()); |
1019 } | 1019 } |
1020 if (r is null) | 1020 if (r is null) |
1021 return; | 1021 return; |
1022 | 1022 |
1023 if (fSourceViewer instanceof ITextViewerExtension2) { | 1023 if ( cast(ITextViewerExtension2)fSourceViewer ) { |
1024 if cast(DEBUG) | 1024 if cast(DEBUG) |
1025 System.out.println("AP: invalidating offset: " + r.getOffset() + ", length= " + r.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ | 1025 System.out.println("AP: invalidating offset: " + r.getOffset() + ", length= " + r.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ |
1026 | 1026 |
1027 (cast(ITextViewerExtension2)fSourceViewer).invalidateTextPresentation(r.getOffset(), r.getLength()); | 1027 (cast(ITextViewerExtension2)fSourceViewer).invalidateTextPresentation(r.getOffset(), r.getLength()); |
1028 | 1028 |
1064 maxLayer= Math.max(maxLayer, pp.fLayer + 1); // dynamically update layer maximum | 1064 maxLayer= Math.max(maxLayer, pp.fLayer + 1); // dynamically update layer maximum |
1065 if (pp.fLayer !is layer) // wrong layer: skip annotation | 1065 if (pp.fLayer !is layer) // wrong layer: skip annotation |
1066 continue; | 1066 continue; |
1067 | 1067 |
1068 Position p= pp.fPosition; | 1068 Position p= pp.fPosition; |
1069 if (fSourceViewer instanceof ITextViewerExtension5) { | 1069 if ( cast(ITextViewerExtension5)fSourceViewer ) { |
1070 ITextViewerExtension5 extension3= cast(ITextViewerExtension5) fSourceViewer; | 1070 ITextViewerExtension5 extension3= cast(ITextViewerExtension5) fSourceViewer; |
1071 if (null is extension3.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()))) | 1071 if (null is extension3.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()))) |
1072 continue; | 1072 continue; |
1073 } else if (!fSourceViewer.overlapsWithVisibleRegion(p.offset, p.length)) { | 1073 } else if (!fSourceViewer.overlapsWithVisibleRegion(p.offset, p.length)) { |
1074 continue; | 1074 continue; |
1586 fReusableRegion.setLength(modelLength); | 1586 fReusableRegion.setLength(modelLength); |
1587 | 1587 |
1588 if (fReusableRegion is null || fReusableRegion.getOffset() is Integer.MAX_VALUE) | 1588 if (fReusableRegion is null || fReusableRegion.getOffset() is Integer.MAX_VALUE) |
1589 return null; | 1589 return null; |
1590 | 1590 |
1591 if (fSourceViewer instanceof ITextViewerExtension5) { | 1591 if ( cast(ITextViewerExtension5)fSourceViewer ) { |
1592 ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; | 1592 ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; |
1593 return extension.modelRange2WidgetRange(fReusableRegion); | 1593 return extension.modelRange2WidgetRange(fReusableRegion); |
1594 } | 1594 } |
1595 | 1595 |
1596 IRegion region= fSourceViewer.getVisibleRegion(); | 1596 IRegion region= fSourceViewer.getVisibleRegion(); |
1616 */ | 1616 */ |
1617 private IRegion getModelRange(int offset, int length) { | 1617 private IRegion getModelRange(int offset, int length) { |
1618 if (offset is Integer.MAX_VALUE) | 1618 if (offset is Integer.MAX_VALUE) |
1619 return null; | 1619 return null; |
1620 | 1620 |
1621 if (fSourceViewer instanceof ITextViewerExtension5) { | 1621 if ( cast(ITextViewerExtension5)fSourceViewer ) { |
1622 ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; | 1622 ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; |
1623 return extension.widgetRange2ModelRange(new Region(offset, length)); | 1623 return extension.widgetRange2ModelRange(new Region(offset, length)); |
1624 } | 1624 } |
1625 | 1625 |
1626 IRegion region= fSourceViewer.getVisibleRegion(); | 1626 IRegion region= fSourceViewer.getVisibleRegion(); |