diff dwtx/jface/text/DefaultUndoManager.d @ 140:26688fec6d23

Following dsss compile errors
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 03:23:46 +0200
parents b6bad70d540a
children eb21d3dfc767
line wrap: on
line diff
--- a/dwtx/jface/text/DefaultUndoManager.d	Sun Aug 24 02:31:41 2008 +0200
+++ b/dwtx/jface/text/DefaultUndoManager.d	Sun Aug 24 03:23:46 2008 +0200
@@ -301,24 +301,24 @@
          * @since 3.1
          */
         public bool canUndo() {
-            
+
             if (isConnected() && isValid()) {
                 IDocument doc= fTextViewer.getDocument();
                 if ( cast(IDocumentExtension4)doc ) {
                     long docStamp= (cast(IDocumentExtension4)doc).getModificationStamp();
-                    
+
                     // Normal case: an undo is valid if its redo will restore document
                     // to its current modification stamp
-                    bool canUndo= docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || 
+                    bool canUndo= docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
                         docStamp is getRedoModificationStamp();
-                    
-                    /* Special case to check if the answer is false.  
+
+                    /* Special case to check if the answer is false.
                      * If the last document change was empty, then the document's
-                     * modification stamp was incremented but nothing was committed.  
+                     * modification stamp was incremented but nothing was committed.
                      * The operation being queried has an older stamp.  In this case only,
                      * the comparison is different.  A sequence of document changes that
                      * include an empty change is handled correctly when a valid commit
-                     * follows the empty change, but when #canUndo() is queried just after 
+                     * follows the empty change, but when #canUndo() is queried just after
                      * an empty change, we must special case the check.  The check is very
                      * specific to prevent false positives.
                      * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=98245
@@ -329,17 +329,17 @@
                             !fCurrent.isValid() &&  // the current operation is not a valid document modification
                             fCurrent.fUndoModificationStamp !is // the invalid current operation has a document stamp
                                 IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) {
-                        canUndo= fCurrent.fRedoModificationStamp is docStamp;                           
+                        canUndo= fCurrent.fRedoModificationStamp is docStamp;
                     }
                     /*
-                     * When the composite is the current command, it may hold the timestamp 
-                     * of a no-op change.  We check this here rather than in an override of 
+                     * When the composite is the current command, it may hold the timestamp
+                     * of a no-op change.  We check this here rather than in an override of
                      * canUndo() in CompoundTextCommand simply to keep all the special case checks
                      * in one place.
-                     */ 
+                     */
                     if (!canUndo &&
                             this is fHistory.getUndoOperation(fUndoContext)  &&  // this is the latest operation
-                            this instanceof CompoundTextCommand &&
+                            null !is cast(CompoundTextCommand)this &&
                             this is fCurrent && // this is the current operation
                             this.fStart is -1 &&  // the current operation text is not valid
                             fCurrent.fRedoModificationStamp !is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) {  // but it has a redo stamp
@@ -362,7 +362,7 @@
                 IDocument doc= fTextViewer.getDocument();
                 if ( cast(IDocumentExtension4)doc ) {
                     long docStamp= (cast(IDocumentExtension4)doc).getModificationStamp();
-                    return docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || 
+                    return docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
                         docStamp is getUndoModificationStamp();
                 }
                 // if there is no timestamp to check, simply return true per the 3.0.1 behavior
@@ -410,7 +410,7 @@
             }
             return IOperationHistory.OPERATION_INVALID_STATUS;
         }
-        
+
         /**
          * Re-applies the change described by this command.
          *
@@ -497,11 +497,11 @@
                 fPreservedText= fPreservedTextBuffer.toString();
             }
         }
-        
+
         /**
          * Attempt a commit of this command and answer true if a new
          * fCurrent was created as a result of the commit.
-         * 
+         *
          * @return true if the command was committed and created a
          * new fCurrent, false if not.
          * @since 3.1
@@ -555,20 +555,20 @@
             text.append('\'');
             return text.toString();
         }
-        
+
         /**
          * Return the undo modification stamp
-         * 
+         *
          * @return the undo modification stamp for this command
          * @since 3.1
          */
         protected long getUndoModificationStamp() {
             return fUndoModificationStamp;
         }
-        
+
         /**
          * Return the redo modification stamp
-         * 
+         *
          * @return the redo modification stamp for this command
          * @since 3.1
          */
@@ -610,7 +610,7 @@
          */
         public IStatus undo(IProgressMonitor monitor, IAdaptable uiInfo) {
             resetProcessChangeSate();
-            
+
             int size= fCommands.size();
             if (size > 0) {
 
@@ -707,10 +707,10 @@
                 return (fStart > -1 || fCommands.size() > 0);
             return false;
         }
-        
+
         /**
          * Returns the undo modification stamp.
-         * 
+         *
          * @return the undo modification stamp
          * @since 3.1
          */
@@ -722,10 +722,10 @@
 
             return fUndoModificationStamp;
         }
-        
+
         /**
          * Returns the redo modification stamp.
-         * 
+         *
          * @return the redo modification stamp
          * @since 3.1
          */
@@ -886,11 +886,11 @@
                         public void run() {
                             // if we are undoing/redoing a command we generated, then ignore
                             // the document changes associated with this undo or redo.
-                            if (event.getOperation() instanceof TextCommand) {
+                            if (cast(TextCommand)event.getOperation() ) {
                                 if ( cast(TextViewer)fTextViewer )
                                     (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
                                 listenToTextChanges(false);
-    
+
                                 // in the undo case only, make sure compounds are closed
                                 if (type is OperationHistoryEvent.ABOUT_TO_UNDO) {
                                     if (fFoldingIntoCompoundChange) {
@@ -898,9 +898,9 @@
                                     }
                                 }
                             } else {
-                                // the undo or redo has our context, but it is not one of 
+                                // the undo or redo has our context, but it is not one of
                                 // our commands.  We will listen to the changes, but will
-                                // reset the state that tracks the undo/redo history. 
+                                // reset the state that tracks the undo/redo history.
                                 commit();
                                 fLastAddedCommand= null;
                             }
@@ -1070,7 +1070,7 @@
      * @since 3.1
      */
     private void addToCommandStack(TextCommand command){
-        if (!fFoldingIntoCompoundChange || command instanceof CompoundTextCommand) {
+        if (!fFoldingIntoCompoundChange || cast(CompoundTextCommand)command ) {
             fHistory.add(command);
             fLastAddedCommand= command;
         }
@@ -1129,10 +1129,10 @@
         }
         fCurrent.commit();
     }
-    
+
     /**
      * Reset processChange state.
-     *   
+     *
      * @since 3.2
      */
     private void resetProcessChangeSate() {
@@ -1179,7 +1179,7 @@
 
         int length= insertedText.length();
         int diff= modelEnd - modelStart;
-        
+
         if (fCurrent.fUndoModificationStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP)
             fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
 
@@ -1198,7 +1198,7 @@
                     fCurrent.fRedoModificationStamp= beforeChangeModificationStamp;
                     if (fCurrent.attemptCommit())
                         fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
-                        
+
                     fInserting= true;
                 }
                 if (fCurrent.fStart < 0)
@@ -1302,7 +1302,7 @@
                 // because of typing or pasting whereby selection is not empty
                 fCurrent.fRedoModificationStamp= beforeChangeModificationStamp;
                 if (fCurrent.attemptCommit())
-                    fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;                 
+                    fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
 
                 fCurrent.fStart= modelStart;
                 fCurrent.fEnd= modelEnd;