diff dwtx/jface/internal/text/revisions/RevisionPainter.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/internal/text/revisions/RevisionPainter.d	Sun Aug 24 01:29:22 2008 +0200
+++ b/dwtx/jface/internal/text/revisions/RevisionPainter.d	Sun Aug 24 01:46:20 2008 +0200
@@ -172,7 +172,7 @@
                 return;
             List revisions= new ArrayList();
             for (Iterator it= info.getRevisions().iterator(); it.hasNext();) {
-                Revision revision= (Revision) it.next();
+                Revision revision= cast(Revision) it.next();
                 revisions.add(new Long(computeAge(revision)));
             }
             Collections.sort(revisions);
@@ -206,7 +206,7 @@
                 if (index is -1 || size < 2)
                     scale= 0.5f;
                 else
-                    scale= (float) index / (size - 1);
+                    scale= cast(float) index / (size - 1);
             } else {
                 Assert.isTrue(false);
                 return null; // dummy
@@ -259,7 +259,7 @@
          */
         public RGB getColor(Revision revision, bool focus) {
             Map map= focus ? fFocusColors : fColors;
-            RGB color= (RGB) map.get(revision);
+            RGB color= cast(RGB) map.get(revision);
             if (color !is null)
                 return color;
             
@@ -416,7 +416,7 @@
          */
         public bool canReplace(IInformationControlCreator creator) {
             return creator.getClass() is getClass()
-                    && ((HoverInformationControlCreator) creator).fIsFocusable is fIsFocusable;
+                    && (cast(HoverInformationControlCreator) creator).fIsFocusable is fIsFocusable;
         }
     }
 
@@ -657,7 +657,7 @@
             fRevisionInfo= info;
             clearRangeCache();
             updateFocusRange(null);
-            handleRevisionSelected((Revision) null);
+            handleRevisionSelected(cast(Revision) null);
             fColorTool.setInfo(info);
             postRedraw();
             informListeners();
@@ -735,7 +735,7 @@
         // draw change regions
         List/* <RevisionRange> */ranges= getRanges(visibleLines);
         for (Iterator it= ranges.iterator(); it.hasNext();) {
-            RevisionRange region= (RevisionRange) it.next();
+            RevisionRange region= cast(RevisionRange) it.next();
             paintRange(region, gc);
         }
     }
@@ -794,7 +794,7 @@
     public void setModel(IAnnotationModel model) {
         IAnnotationModel diffModel;
         if (model instanceof IAnnotationModelExtension)
-            diffModel= ((IAnnotationModelExtension) model).getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
+            diffModel= (cast(IAnnotationModelExtension) model).getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
         else
             diffModel= model;
 
@@ -821,10 +821,10 @@
         if (differ instanceof ILineDiffer || differ is null) {
             if (fLineDiffer !is differ) {
                 if (fLineDiffer !is null)
-                    ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
-                fLineDiffer= (ILineDiffer) differ;
+                    (cast(IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
+                fLineDiffer= cast(ILineDiffer) differ;
                 if (fLineDiffer !is null)
-                    ((IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener);
+                    (cast(IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener);
             }
         }
     }
@@ -836,7 +836,7 @@
         updateFocusLine(-1);
 
         if (fLineDiffer !is null) {
-            ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
+            (cast(IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
             fLineDiffer= null;
         }
         
@@ -947,13 +947,13 @@
             return null;
 
         for (Iterator it= ranges.iterator(); it.hasNext();) {
-            RevisionRange range= (RevisionRange) it.next();
+            RevisionRange range= cast(RevisionRange) it.next();
             if (contains(range, line))
                 return range;
         }
 
         // line may be right after the last region
-        RevisionRange lastRegion= (RevisionRange) ranges.get(ranges.size() - 1);
+        RevisionRange lastRegion= cast(RevisionRange) ranges.get(ranges.size() - 1);
         if (line is end(lastRegion))
             return lastRegion;
         return null;
@@ -972,7 +972,7 @@
         int end= end(lines);
         int first= -1, last= -1;
         for (int i= 0; i < ranges.size(); i++) {
-            RevisionRange range= (RevisionRange) ranges.get(i);
+            RevisionRange range= cast(RevisionRange) ranges.get(i);
             int rangeEnd= end(range);
             if (first is -1 && rangeEnd > lines.getStartLine())
                 first= i;
@@ -1053,7 +1053,7 @@
         int widgetStartLine= -1;
         int widgetEndLine= -1;
         if (fViewer instanceof ITextViewerExtension5) {
-            ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
+            ITextViewerExtension5 extension= cast(ITextViewerExtension5) fViewer;
             int modelEndLine= end(range);
             for (int modelLine= range.getStartLine(); modelLine < modelEndLine; modelLine++) {
                 int widgetLine= extension.modelLine2WidgetLine(modelLine);
@@ -1118,7 +1118,7 @@
         if (revision !is null) {
             added= new HashMap();
             for (Iterator it= revision.getRegions().iterator(); it.hasNext();) {
-                RevisionRange range= (RevisionRange) it.next();
+                RevisionRange range= cast(RevisionRange) it.next();
                 try {
                     IRegion charRegion= toCharRegion(range);
                     Position position= new Position(charRegion.getOffset(), charRegion.getLength());
@@ -1131,17 +1131,17 @@
         }
 
         if (fAnnotationModel instanceof IAnnotationModelExtension) {
-            IAnnotationModelExtension ext= (IAnnotationModelExtension) fAnnotationModel;
+            IAnnotationModelExtension ext= cast(IAnnotationModelExtension) fAnnotationModel;
             ext.replaceAnnotations((Annotation[]) fAnnotations.toArray(new Annotation[fAnnotations.size()]), added);
         } else {
             for (Iterator it= fAnnotations.iterator(); it.hasNext();) {
-                Annotation annotation= (Annotation) it.next();
+                Annotation annotation= cast(Annotation) it.next();
                 fAnnotationModel.removeAnnotation(annotation);
             }
             if (added !is null) {
                 for (Iterator it= added.entrySet().iterator(); it.hasNext();) {
-                    Entry entry= (Entry) it.next();
-                    fAnnotationModel.addAnnotation((Annotation) entry.getKey(), (Position) entry.getValue());
+                    Entry entry= cast(Entry) it.next();
+                    fAnnotationModel.addAnnotation(cast(Annotation) entry.getKey(), cast(Position) entry.getValue());
                 }
             }
         }
@@ -1193,7 +1193,7 @@
             return;
 
         for (Iterator it= fRevisionInfo.getRevisions().iterator(); it.hasNext();) {
-            Revision revision= (Revision) it.next();
+            Revision revision= cast(Revision) it.next();
             if (id.equals(revision.getId())) {
                 handleRevisionSelected(revision);
                 return;
@@ -1201,7 +1201,7 @@
         }
 
         // clear selection if it does not exist
-        handleRevisionSelected((Revision) null);
+        handleRevisionSelected(cast(Revision) null);
     }
 
     /**
@@ -1230,7 +1230,7 @@
      * @param nextLine the new focus line (-1 for no focus)
      */
     private void onFocusLineChanged(int previousLine, int nextLine) {
-        if (DEBUG)
+        if cast(DEBUG)
             System.out.println("line: " + previousLine + " > " + nextLine); //$NON-NLS-1$ //$NON-NLS-2$
         fFocusLine= nextLine;
         RevisionRange region= getRange(nextLine);
@@ -1254,7 +1254,7 @@
      * @param nextRange the new focus range (<code>null</code> for no focus)
      */
     private void onFocusRangeChanged(RevisionRange previousRange, RevisionRange nextRange) {
-        if (DEBUG)
+        if cast(DEBUG)
             System.out.println("range: " + previousRange + " > " + nextRange); //$NON-NLS-1$ //$NON-NLS-2$
         fFocusRange= nextRange;
         Revision revision= nextRange is null ? null : nextRange.getRevision();
@@ -1273,7 +1273,7 @@
      * @param nextRevision the new focus revision (<code>null</code> for no focus)
      */
     private void onFocusRevisionChanged(Revision previousRevision, Revision nextRevision) {
-        if (DEBUG)
+        if cast(DEBUG)
             System.out.println("revision: " + previousRevision + " > " + nextRevision); //$NON-NLS-1$ //$NON-NLS-2$
         fFocusRevision= nextRevision;
         uninstallWheelHandler();
@@ -1317,7 +1317,7 @@
         List ranges= fFocusRevision.getRegions();
         if (up) {
             for (Iterator it= ranges.iterator(); it.hasNext();) {
-                RevisionRange range= (RevisionRange) it.next();
+                RevisionRange range= cast(RevisionRange) it.next();
                 ILineRange widgetRange= modelLinesToWidgetLines(range);
                 if (contains(range, documentHoverLine)) {
                     nextWidgetRange= last;
@@ -1328,7 +1328,7 @@
             }
         } else {
             for (ListIterator it= ranges.listIterator(ranges.size()); it.hasPrevious();) {
-                RevisionRange range= (RevisionRange) it.previous();
+                RevisionRange range= cast(RevisionRange) it.previous();
                 ILineRange widgetRange= modelLinesToWidgetLines(range);
                 if (contains(range, documentHoverLine)) {
                     nextWidgetRange= last;
@@ -1440,7 +1440,7 @@
      * @return <code>true</code> if the receiver can provide a hover
      */
     public bool hasHover(int activeLine) {
-        return fViewer instanceof ISourceViewer && fHover.getHoverLineRange((ISourceViewer) fViewer, activeLine) !is null;
+        return fViewer instanceof ISourceViewer && fHover.getHoverLineRange(cast(ISourceViewer) fViewer, activeLine) !is null;
     }
 
     /**
@@ -1486,7 +1486,7 @@
                 int revisionWidth= 0;
                 int authorWidth= 0;
                 for (Iterator it= fRevisionInfo.getRevisions().iterator(); it.hasNext();) {
-                    Revision revision= (Revision) it.next();
+                    Revision revision= cast(Revision) it.next();
                     revisionWidth= Math.max(revisionWidth, revision.getId().length());
                     authorWidth= Math.max(authorWidth, revision.getAuthor().length());
                 }
@@ -1564,7 +1564,7 @@
         RevisionEvent event= new RevisionEvent(fRevisionInfo);
         Object[] listeners= fRevisionListeners.getListeners();
         for (int i= 0; i < listeners.length; i++) {
-            IRevisionListener listener= (IRevisionListener) listeners[i];
+            IRevisionListener listener= cast(IRevisionListener) listeners[i];
             listener.revisionInformationChanged(event);
         }
     }