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

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 3678e4f1a766
children
line wrap: on
line diff
--- a/dwtx/jface/text/TextSelection.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/TextSelection.d	Mon Sep 08 00:51:37 2008 +0200
@@ -167,7 +167,17 @@
 public class TextSelection : ITextSelection {
 
     /** Internal empty text selection */
-    private const static ITextSelection NULL= new TextSelection();
+    private static ITextSelection NULL_;
+    private static ITextSelection NULL(){
+        if( NULL_ is null ){
+            synchronized( TextSelection.classinfo ){
+                if( NULL_ is null ){
+                    NULL_= new TextSelection();
+                }
+            }
+        }
+        return NULL_;
+    }
 
     /**
      * Returns a shared instance of an empty text selection.
@@ -295,11 +305,11 @@
     /*
      * @see java.lang.Object#equals(Object)
      */
-    public bool equals(Object obj) {
+    public override int opEquals(Object obj) {
         if (obj is this)
             return true;
 
-        if (obj is null || getClass() !is obj.getClass())
+        if (obj is null || this.classinfo !is obj.classinfo)
             return false;
 
         TextSelection s= cast(TextSelection) obj;
@@ -314,7 +324,7 @@
             try {
                 String sContent= s.fDocument.get(fOffset, fLength);
                 String content= fDocument.get(fOffset, fLength);
-                return sContent.equals(content);
+                return sContent==/+eq+/content;
             } catch (BadLocationException x) {
             }
         }
@@ -326,7 +336,7 @@
      * @see java.lang.Object#hashCode()
      */
     public override hash_t toHash() {
-        int low= fDocument !is null ? fDocument.toHash() : 0;
+        int low= fDocument !is null ? (cast(Object)fDocument).toHash() : 0;
         return (fOffset << 24) | (fLength << 16) | low;
     }
 }