diff dwtx/jface/text/DefaultUndoManager.d @ 134:51e6e63f930e

Regex fix for casts
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 01:46:20 +0200
parents 7d818bd32d63
children 65801ad2b265
line wrap: on
line diff
--- a/dwtx/jface/text/DefaultUndoManager.d	Sun Aug 24 01:29:22 2008 +0200
+++ b/dwtx/jface/text/DefaultUndoManager.d	Sun Aug 24 01:46:20 2008 +0200
@@ -289,7 +289,7 @@
             try {
                 IDocument document= fTextViewer.getDocument();
                 if (document instanceof IDocumentExtension4)
-                    ((IDocumentExtension4)document).replace(fStart, fText.length(), fPreservedText, fUndoModificationStamp);
+                    (cast(IDocumentExtension4)document).replace(fStart, fText.length(), fPreservedText, fUndoModificationStamp);
                 else
                     document.replace(fStart, fText.length(), fPreservedText);
             } catch (BadLocationException x) {
@@ -305,7 +305,7 @@
             if (isConnected() && isValid()) {
                 IDocument doc= fTextViewer.getDocument();
                 if (doc instanceof IDocumentExtension4) {
-                    long docStamp= ((IDocumentExtension4)doc).getModificationStamp();
+                    long docStamp= (cast(IDocumentExtension4)doc).getModificationStamp();
                     
                     // Normal case: an undo is valid if its redo will restore document
                     // to its current modification stamp
@@ -361,7 +361,7 @@
             if (isConnected() && isValid()) {
                 IDocument doc= fTextViewer.getDocument();
                 if (doc instanceof IDocumentExtension4) {
-                    long docStamp= ((IDocumentExtension4)doc).getModificationStamp();
+                    long docStamp= (cast(IDocumentExtension4)doc).getModificationStamp();
                     return docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || 
                         docStamp is getUndoModificationStamp();
                 }
@@ -420,7 +420,7 @@
             try {
                 IDocument document= fTextViewer.getDocument();
                 if (document instanceof IDocumentExtension4)
-                    ((IDocumentExtension4)document).replace(fStart, fEnd - fStart, fText, fRedoModificationStamp);
+                    (cast(IDocumentExtension4)document).replace(fStart, fEnd - fStart, fText, fRedoModificationStamp);
                 else
                     fTextViewer.getDocument().replace(fStart, fEnd - fStart, fText);
             } catch (BadLocationException x) {
@@ -617,11 +617,11 @@
                 TextCommand c;
 
                 for (int i= size -1; i > 0;  --i) {
-                    c= (TextCommand) fCommands.get(i);
+                    c= cast(TextCommand) fCommands.get(i);
                     c.undoTextChange();
                 }
 
-                c= (TextCommand) fCommands.get(0);
+                c= cast(TextCommand) fCommands.get(0);
                 c.undo(monitor, uiInfo);
             }
 
@@ -640,11 +640,11 @@
                 TextCommand c;
 
                 for (int i= 0; i < size -1;  ++i) {
-                    c= (TextCommand) fCommands.get(i);
+                    c= cast(TextCommand) fCommands.get(i);
                     c.redoTextChange();
                 }
 
-                c= (TextCommand) fCommands.get(size -1);
+                c= cast(TextCommand) fCommands.get(size -1);
                 c.redo(monitor, uiInfo);
             }
             return Status.OK_STATUS;
@@ -718,7 +718,7 @@
             if (fStart > -1)
                 return super.getUndoModificationStamp();
             else if (fCommands.size() > 0)
-                return ((TextCommand)fCommands.get(0)).getUndoModificationStamp();
+                return (cast(TextCommand)fCommands.get(0)).getUndoModificationStamp();
 
             return fUndoModificationStamp;
         }
@@ -733,7 +733,7 @@
             if (fStart > -1)
                 return super.getRedoModificationStamp();
             else if (fCommands.size() > 0)
-                return ((TextCommand)fCommands.get(fCommands.size()-1)).getRedoModificationStamp();
+                return (cast(TextCommand)fCommands.get(fCommands.size()-1)).getRedoModificationStamp();
 
             return fRedoModificationStamp;
         }
@@ -888,7 +888,7 @@
                             // the document changes associated with this undo or redo.
                             if (event.getOperation() instanceof TextCommand) {
                                 if (fTextViewer instanceof TextViewer)
-                                    ((TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
+                                    (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
                                 listenToTextChanges(false);
     
                                 // in the undo case only, make sure compounds are closed
@@ -918,7 +918,7 @@
                             listenToTextChanges(true);
                             fOperation= null;
                             if (fTextViewer instanceof TextViewer)
-                                ((TextViewer)fTextViewer).ignoreAutoEditStrategies(false);
+                                (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(false);
                          }
                     });
                 }
@@ -1459,7 +1459,7 @@
      */
     protected void selectAndReveal(int offset, int length) {
         if (fTextViewer instanceof ITextViewerExtension5) {
-            ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
+            ITextViewerExtension5 extension= cast(ITextViewerExtension5) fTextViewer;
             extension.exposeModelRange(new Region(offset, length));
         } else if (!fTextViewer.overlapsWithVisibleRegion(offset, length))
             fTextViewer.resetVisibleRegion();