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

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 3678e4f1a766
children c3583c6ec027
line wrap: on
line diff
--- a/dwtx/jface/text/source/SourceViewer.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/source/SourceViewer.d	Mon Sep 08 00:51:37 2008 +0200
@@ -229,7 +229,17 @@
      * Key of the model annotation model inside the visual annotation model.
      * @since 3.0
      */
-    protected final static Object MODEL_ANNOTATION_MODEL= new Object();
+    private static Object MODEL_ANNOTATION_MODEL_;
+    protected static Object MODEL_ANNOTATION_MODEL(){
+        if( MODEL_ANNOTATION_MODEL_ is null ){
+            synchronized(SourceViewer.classinfo ){
+                if( MODEL_ANNOTATION_MODEL_ is null ){
+                    MODEL_ANNOTATION_MODEL_ = new Object();
+                }
+            }
+        }
+        return MODEL_ANNOTATION_MODEL_;
+    }
 
     /** The viewer's content assistant */
     protected IContentAssistant fContentAssistant;
@@ -265,7 +275,7 @@
      * Stack of saved selections in the underlying document
      * @since 3.0
      */
-    protected final Stack fSelections= new Stack();
+    protected const Stack fSelections;
     /**
      * Position updater for saved selections
      * @since 3.0
@@ -344,6 +354,7 @@
      * @since 2.1
      */
     public this(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, bool showAnnotationsOverview, int styles) {
+        fSelections= new Stack();
         super();
 
         fVerticalRuler= verticalRuler;
@@ -794,7 +805,7 @@
         final IDocument document= getDocument();
 
         if (fSelections.isEmpty()) {
-            fSelectionCategory= _SELECTION_POSITION_CATEGORY + toHash();
+            fSelectionCategory= _SELECTION_POSITION_CATEGORY ~ Integer.toString(toHash());
             fSelectionUpdater= new NonDeletingPositionUpdater(fSelectionCategory);
             document.addPositionCategory(fSelectionCategory);
             document.addPositionUpdater(fSelectionUpdater);
@@ -910,10 +921,10 @@
                                 final IContentFormatterExtension extension= cast(IContentFormatterExtension) fContentFormatter;
                                 context= createFormattingContext();
                                 if (selection.y is 0) {
-                                    context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE);
+                                    context.setProperty(stringcast(FormattingContextProperties.CONTEXT_DOCUMENT), Boolean.TRUE);
                                 } else {
-                                    context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.FALSE);
-                                    context.setProperty(FormattingContextProperties.CONTEXT_REGION, new Region(selection.x, selection.y));
+                                    context.setProperty(stringcast(FormattingContextProperties.CONTEXT_DOCUMENT), Boolean.FALSE);
+                                    context.setProperty(stringcast(FormattingContextProperties.CONTEXT_REGION), new Region(selection.x, selection.y));
                                 }
                                 extension.format(document, context);
                             } else {