diff dwtx/jface/text/source/projection/ProjectionSupport.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 25f1f92fa3df
children
line wrap: on
line diff
--- a/dwtx/jface/text/source/projection/ProjectionSupport.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/source/projection/ProjectionSupport.d	Mon Sep 08 00:51:37 2008 +0200
@@ -61,7 +61,17 @@
      * Key of the projection annotation model inside the visual annotation
      * model. Also internally used as key for the projection drawing strategy.
      */
-    public const static Object PROJECTION= new Object();
+    private static Object PROJECTION_;
+    public static Object PROJECTION(){
+        if( PROJECTION_ is null ){
+            synchronized(ProjectionSupport.classinfo){
+                if( PROJECTION_ is null ){
+                    PROJECTION_ = new Object();
+                }
+            }
+        }
+        return PROJECTION_;
+    }
 
     private static class ProjectionAnnotationsPainter : AnnotationPainter {
 
@@ -112,7 +122,7 @@
                         int line= content.getLineAtOffset(offset);
                         int lineStart= content.getOffsetAtLine(line);
                         String text= content.getLine(line);
-                        int lineLength= text is null ? 0 : text.length();
+                        int lineLength= text is null ? 0 : text.length;
                         int lineEnd= lineStart + lineLength;
                         Point p= textWidget.getLocationAtOffset(lineEnd);
 
@@ -313,14 +323,14 @@
         if (fPainter is null) {
             fPainter= new ProjectionAnnotationsPainter(fViewer, fAnnotationAccess);
             fPainter.addDrawingStrategy(PROJECTION, getDrawingStrategy());
-            fPainter.addAnnotationType(ProjectionAnnotation.TYPE, PROJECTION);
-            fPainter.setAnnotationTypeColor(ProjectionAnnotation.TYPE, fSharedTextColors.getColor(getColor()));
+            fPainter.addAnnotationType(stringcast(ProjectionAnnotation.TYPE), PROJECTION);
+            fPainter.setAnnotationTypeColor(stringcast(ProjectionAnnotation.TYPE), fSharedTextColors.getColor(getColor()));
             fViewer.addPainter(fPainter);
         }
 
         if (fColumn is null) {
             fColumn= new ProjectionRulerColumn(9, fAnnotationAccess);
-            fColumn.addAnnotationType(ProjectionAnnotation.TYPE);
+            fColumn.addAnnotationType(stringcast(ProjectionAnnotation.TYPE));
             fColumn.setHover(createProjectionAnnotationHover());
             fViewer.addVerticalRulerColumn(fColumn);
         }
@@ -350,7 +360,7 @@
         if (fSummarizableTypes !is null) {
             int size= fSummarizableTypes.size();
             for (int i= 0; i < size; i++)
-                summary.addAnnotationType(cast(String) fSummarizableTypes.get(i));
+                summary.addAnnotationType(stringcast(fSummarizableTypes.get(i)));
         }
         return summary;
     }