Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/AnnotationPainter.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | 7d818bd32d63 |
children | 65801ad2b265 |
line wrap: on
line diff
--- a/dwtx/jface/text/source/AnnotationPainter.d Sun Aug 24 01:29:22 2008 +0200 +++ b/dwtx/jface/text/source/AnnotationPainter.d Sun Aug 24 01:46:20 2008 +0200 @@ -632,8 +632,8 @@ Iterator iter= decorationsMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry= (Map.Entry)iter.next(); - Annotation annotation= (Annotation)entry.getKey(); - Decoration decoration= (Decoration)entry.getValue(); + Annotation annotation= cast(Annotation)entry.getKey(); + Decoration decoration= cast(Decoration)entry.getValue(); drawDecoration(decoration, null, annotation, clippingRegion, document); } @@ -650,7 +650,7 @@ Annotation[] removedAnnotations= event.getRemovedAnnotations(); for (int i=0, length= removedAnnotations.length; i < length; i++) { Annotation annotation= removedAnnotations[i]; - Decoration decoration= (Decoration)highlightedDecorationsMap.remove(annotation); + Decoration decoration= cast(Decoration)highlightedDecorationsMap.remove(annotation); if (decoration !is null) { Position position= decoration.fPosition; if (position !is null) { @@ -658,7 +658,7 @@ highlightAnnotationRangeEnd= Math.max(highlightAnnotationRangeEnd, position.offset + position.length); } } - decoration= (Decoration)decorationsMap.remove(annotation); + decoration= cast(Decoration)decorationsMap.remove(annotation); if (decoration !is null) { drawDecoration(decoration, null, annotation, clippingRegion, document); Position position= decoration.fPosition; @@ -677,7 +677,7 @@ bool isHighlighting= false; - Decoration decoration= (Decoration)highlightedDecorationsMap.get(annotation); + Decoration decoration= cast(Decoration)highlightedDecorationsMap.get(annotation); if (decoration !is null) { isHighlighting= true; @@ -715,7 +715,7 @@ } if (usesDrawingStrategy) { - Decoration oldDecoration= (Decoration)decorationsMap.get(annotation); + Decoration oldDecoration= cast(Decoration)decorationsMap.get(annotation); if (oldDecoration !is null) { drawDecoration(oldDecoration, null, annotation, clippingRegion, document); @@ -732,7 +732,7 @@ // Add new annotations while (e.hasNext()) { - Annotation annotation= (Annotation) e.next(); + Annotation annotation= cast(Annotation) e.next(); Decoration pp= getDecoration(annotation, null); if (pp !is null) { if (pp.fPaintingStrategy instanceof IDrawingStrategy) { @@ -913,7 +913,7 @@ decoration.fPosition= position; decoration.fColor= color; if (fAnnotationAccess instanceof IAnnotationAccessExtension) { - IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess; + IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; decoration.fLayer= extension.getLayer(annotation); } else { decoration.fLayer= IAnnotationAccessExtension.DEFAULT_LAYER; @@ -943,7 +943,7 @@ } if (fAnnotationAccess instanceof IAnnotationAccessExtension) { - IAnnotationAccessExtension ext = (IAnnotationAccessExtension) fAnnotationAccess; + IAnnotationAccessExtension ext = cast(IAnnotationAccessExtension) fAnnotationAccess; Object[] sts = ext.getSupertypes(type); for (int i= 0; i < sts.length; i++) { strategy= fPaintingStrategyId2PaintingStrategy.get(fAnnotationType2PaintingStrategyId.get(sts[i])); @@ -967,22 +967,22 @@ * @since 3.0 */ private Color getColor(final Object annotationType) { - Color color= (Color)fCachedAnnotationType2Color.get(annotationType); + Color color= cast(Color)fCachedAnnotationType2Color.get(annotationType); if (color !is null) return color; - color= (Color)fAnnotationType2Color.get(annotationType); + color= cast(Color)fAnnotationType2Color.get(annotationType); if (color !is null) { fCachedAnnotationType2Color.put(annotationType, color); return color; } if (fAnnotationAccess instanceof IAnnotationAccessExtension) { - IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess; + IAnnotationAccessExtension extension= cast(IAnnotationAccessExtension) fAnnotationAccess; Object[] superTypes= extension.getSupertypes(annotationType); if (superTypes !is null) { for (int i= 0; i < superTypes.length; i++) { - color= (Color)fAnnotationType2Color.get(superTypes[i]); + color= cast(Color)fAnnotationType2Color.get(superTypes[i]); if (color !is null) { fCachedAnnotationType2Color.put(annotationType, color); return color; @@ -1021,10 +1021,10 @@ return; if (fSourceViewer instanceof ITextViewerExtension2) { - if (DEBUG) + if cast(DEBUG) System.out.println("AP: invalidating offset: " + r.getOffset() + ", length= " + r.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ - ((ITextViewerExtension2)fSourceViewer).invalidateTextPresentation(r.getOffset(), r.getLength()); + (cast(ITextViewerExtension2)fSourceViewer).invalidateTextPresentation(r.getOffset(), r.getLength()); } else { fSourceViewer.invalidateTextPresentation(); @@ -1047,7 +1047,7 @@ IRegion region= tp.getExtent(); - if (DEBUG) + if cast(DEBUG) System.out.println("AP: applying text presentation offset: " + region.getOffset() + ", length= " + region.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ for (int layer= 0, maxLayer= 1; layer < maxLayer; layer++) { @@ -1055,11 +1055,11 @@ for (Iterator iter= decorations.iterator(); iter.hasNext();) { Map.Entry entry= (Map.Entry)iter.next(); - Annotation a= (Annotation)entry.getKey(); + Annotation a= cast(Annotation)entry.getKey(); if (a.isMarkedDeleted()) continue; - Decoration pp = (Decoration)entry.getValue(); + Decoration pp = cast(Decoration)entry.getValue(); maxLayer= Math.max(maxLayer, pp.fLayer + 1); // dynamically update layer maximum if (pp.fLayer !is layer) // wrong layer: skip annotation @@ -1067,7 +1067,7 @@ Position p= pp.fPosition; if (fSourceViewer instanceof ITextViewerExtension5) { - ITextViewerExtension5 extension3= (ITextViewerExtension5) fSourceViewer; + ITextViewerExtension5 extension3= cast(ITextViewerExtension5) fSourceViewer; if (null is extension3.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()))) continue; } else if (!fSourceViewer.overlapsWithVisibleRegion(p.offset, p.length)) { @@ -1081,7 +1081,7 @@ int end= Math.min(regionEnd, pEnd); int length= Math.max(end - start, 0); StyleRange styleRange= new StyleRange(start, length, null, null); - ((ITextStyleStrategy)pp.fPaintingStrategy).applyTextStyle(styleRange, pp.fColor); + (cast(ITextStyleStrategy)pp.fPaintingStrategy).applyTextStyle(styleRange, pp.fColor); tp.mergeStyleRange(styleRange); } } @@ -1092,7 +1092,7 @@ * @see dwtx.jface.text.source.IAnnotationModelListener#modelChanged(dwtx.jface.text.source.IAnnotationModel) */ public synchronized void modelChanged(final IAnnotationModel model) { - if (DEBUG) + if cast(DEBUG) System.err.println("AP: OLD API of AnnotationModelListener called"); //$NON-NLS-1$ modelChanged(new AnnotationModelEvent(model)); @@ -1435,23 +1435,23 @@ for (Iterator e = decorations.iterator(); e.hasNext();) { Map.Entry entry= (Map.Entry)e.next(); - Annotation a= (Annotation)entry.getKey(); - Decoration pp = (Decoration)entry.getValue(); + Annotation a= cast(Annotation)entry.getKey(); + Decoration pp = cast(Decoration)entry.getValue(); // prune any annotation that is not drawable or does not need drawing if (!(a.isMarkedDeleted() || skip(a) || !pp.fPosition.overlapsWith(vOffset, vLength))) { // ensure sized appropriately for (int i= toBeDrawn.size(); i <= pp.fLayer; i++) toBeDrawn.add(new LinkedList()); - ((List) toBeDrawn.get(pp.fLayer)).add(entry); + (cast(List) toBeDrawn.get(pp.fLayer)).add(entry); } } IDocument document= fSourceViewer.getDocument(); for (Iterator it= toBeDrawn.iterator(); it.hasNext();) { - List layer= (List) it.next(); + List layer= cast(List) it.next(); for (Iterator e = layer.iterator(); e.hasNext();) { Map.Entry entry= (Map.Entry)e.next(); - Annotation a= (Annotation)entry.getKey(); - Decoration pp = (Decoration)entry.getValue(); + Annotation a= cast(Annotation)entry.getKey(); + Decoration pp = cast(Decoration)entry.getValue(); drawDecoration(pp, gc, a, clippingRegion, document); } } @@ -1464,7 +1464,7 @@ if (!(pp.fPaintingStrategy instanceof IDrawingStrategy)) return; - IDrawingStrategy drawingStrategy= (IDrawingStrategy)pp.fPaintingStrategy; + IDrawingStrategy drawingStrategy= cast(IDrawingStrategy)pp.fPaintingStrategy; int clippingOffset= clippingRegion.getOffset(); int clippingLength= clippingRegion.getLength(); @@ -1589,7 +1589,7 @@ return null; if (fSourceViewer instanceof ITextViewerExtension5) { - ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer; + ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; return extension.modelRange2WidgetRange(fReusableRegion); } @@ -1619,7 +1619,7 @@ return null; if (fSourceViewer instanceof ITextViewerExtension5) { - ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer; + ITextViewerExtension5 extension= cast(ITextViewerExtension5) fSourceViewer; return extension.widgetRange2ModelRange(new Region(offset, length)); }