diff dwtx/jface/text/TextViewer.d @ 174:c6d7b1ea700b

First sample running
author Frank Benoit <benoit@tionex.de>
date Thu, 11 Sep 2008 00:32:24 +0200
parents d994a8b2cdf7
children 0e2944da7cd0
line wrap: on
line diff
--- a/dwtx/jface/text/TextViewer.d	Wed Sep 10 23:17:25 2008 +0200
+++ b/dwtx/jface/text/TextViewer.d	Thu Sep 11 00:32:24 2008 +0200
@@ -1684,7 +1684,7 @@
      * Queued post selection changed events count.
      * @since 3.0
      */
-    private /+const+/ int[] fNumberOfPostSelectionChangedEvents;
+    private /+const+/ int[1] fNumberOfPostSelectionChangedEvents;
     /**
      * Last selection range sent to post selection change listeners.
      * @since 3.0
@@ -1802,7 +1802,6 @@
         MARK_POSITION_CATEGORY=Format("__mark_category_{}", toHash()); //$NON-NLS-1$
         fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY);
         fDocumentRewriteSessionListener= new DocumentRewriteSessionListener();
-        fNumberOfPostSelectionChangedEvents= new int[1];
         fEditorHelpers= new HashSet();
     }
     /**
@@ -2653,27 +2652,21 @@
             return;
 
         fNumberOfPostSelectionChangedEvents[0]++;
-        display.timerExec(getEmptySelectionChangedEventDelay(), new class()  Runnable {
-            const int id;
-            this(){
-                id = fNumberOfPostSelectionChangedEvents[0];
-            }
-            public void run() {
-                if (id is fNumberOfPostSelectionChangedEvents[0]) {
-                    // Check again because this is executed after the delay
-                    if (getDisplay() !is null)  {
-                        Point selection= fTextWidget.getSelectionRange();
-                        if (selection !is null) {
-                            IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y));
-                            if (fireEqualSelection || (r !is null && !(cast(Object)r).opEquals(cast(Object)fLastSentPostSelectionChange)) || r is null)  {
-                                fLastSentPostSelectionChange= r;
-                                firePostSelectionChanged(selection.x, selection.y);
-                            }
+        display.timerExec(getEmptySelectionChangedEventDelay(), dgRunnable( (int id, bool fireEqualSelection_) {
+            if (id is fNumberOfPostSelectionChangedEvents[0]) {
+                // Check again because this is executed after the delay
+                if (getDisplay() !is null)  {
+                    Point selection= fTextWidget.getSelectionRange();
+                    if (selection !is null) {
+                        IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y));
+                        if (fireEqualSelection_ || (r !is null && !(cast(Object)r).opEquals(cast(Object)fLastSentPostSelectionChange)) || r is null)  {
+                            fLastSentPostSelectionChange= r;
+                            firePostSelectionChanged(selection.x, selection.y);
                         }
                     }
                 }
             }
-        });
+        }, fNumberOfPostSelectionChangedEvents[0], fireEqualSelection));
     }
 
     /**