diff dwtx/text/undo/DocumentUndoManager.d @ 130:b56e9be9fe88

ctors to this
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 00:30:47 +0200
parents eb30df5ca28b
children c4fb132a086c
line wrap: on
line diff
--- a/dwtx/text/undo/DocumentUndoManager.d	Sat Aug 23 19:10:48 2008 +0200
+++ b/dwtx/text/undo/DocumentUndoManager.d	Sun Aug 24 00:30:47 2008 +0200
@@ -55,7 +55,7 @@
  * <p>
  * This class is not intended to be subclassed.
  * </p>
- * 
+ *
  * @see IDocumentUndoManager
  * @see DocumentUndoManagerRegistry
  * @see IDocumentUndoListener
@@ -64,8 +64,8 @@
  * @noextend This class is not intended to be subclassed by clients.
  */
 public class DocumentUndoManager : IDocumentUndoManager {
-    
-    
+
+
     /**
      * Represents an undo-able text change, described as the
      * replacement of some preserved text with new text.
@@ -98,10 +98,10 @@
 
         /**
          * Creates a new text change.
-         * 
+         *
          * @param manager the undo manager for this change
          */
-        UndoableTextChange(DocumentUndoManager manager) {
+        this(DocumentUndoManager manager) {
             super(UndoMessages.getString("DocumentUndoManager.operationLabel")); //$NON-NLS-1$
             this.fDocumentUndoManager= manager;
             addContext(manager.getUndoContext());
@@ -119,7 +119,7 @@
 
         /**
          * Sets the start and the end index of this change.
-         * 
+         *
          * @param start the start index
          * @param end the end index
          */
@@ -287,7 +287,7 @@
         /**
          * Re-applies the change described by this change that was previously
          * undone. Also notifies clients about the redo.
-         * 
+         *
          * @param monitor the progress monitor to use if necessary
          * @param uiInfo an adaptable that can provide UI info if needed
          * @return the status
@@ -317,7 +317,7 @@
         /**
          * Creates a new uncommitted text change depending on whether a compound
          * change is currently being executed.
-         * 
+         *
          * @return a new, uncommitted text change or a compound text change
          */
         protected UndoableTextChange createCurrent() {
@@ -357,7 +357,7 @@
         /**
          * Attempt a commit of this change and answer true if a new fCurrent was
          * created as a result of the commit.
-         * 
+         *
          * @return <code>true</code> if the change was committed and created
          *          a new <code>fCurrent</code>, <code>false</code> if not
          */
@@ -372,7 +372,7 @@
 
         /**
          * Checks whether this text change is valid for undo or redo.
-         * 
+         *
          * @return <code>true</code> if the change is valid for undo or redo
          */
         protected bool isValid() {
@@ -409,7 +409,7 @@
 
         /**
          * Return the undo modification stamp
-         * 
+         *
          * @return the undo modification stamp for this change
          */
         protected long getUndoModificationStamp() {
@@ -418,15 +418,15 @@
 
         /**
          * Return the redo modification stamp
-         * 
+         *
          * @return the redo modification stamp for this change
          */
         protected long getRedoModificationStamp() {
             return fRedoModificationStamp;
         }
     }
-    
-    
+
+
     /**
      * Represents an undo-able text change consisting of several individual
      * changes.
@@ -438,17 +438,17 @@
 
         /**
          * Creates a new compound text change.
-         * 
+         *
          * @param manager
          *            the undo manager for this change
          */
-        UndoableCompoundTextChange(DocumentUndoManager manager) {
+        this(DocumentUndoManager manager) {
             super(manager);
         }
 
         /**
          * Adds a new individual change to this compound change.
-         * 
+         *
          * @param change the change to be added
          */
         protected void add(UndoableTextChange change) {
@@ -544,7 +544,7 @@
             fDocumentUndoManager.fCurrent= createCurrent();
             fDocumentUndoManager.resetProcessChangeState();
         }
-        
+
         /*
          * @see dwtx.text.undo.UndoableTextChange#isValid()
          */
@@ -578,7 +578,7 @@
             return fRedoModificationStamp;
         }
     }
-    
+
 
     /**
      * Internal listener to document changes.
@@ -646,7 +646,7 @@
      * @see IOperationHistoryListener
      */
     private class HistoryListener : IOperationHistoryListener {
-        
+
         private IUndoableOperation fOperation;
 
         public void historyNotification(final OperationHistoryEvent event) {
@@ -773,12 +773,12 @@
     private List fConnected;
 
     /**
-     * 
+     *
      * Create a DocumentUndoManager for the given document.
-     * 
+     *
      * @param document the document whose undo history is being managed.
      */
-    public DocumentUndoManager(IDocument document) {
+    public this(IDocument document) {
         super();
         Assert.isNotNull(document);
         fDocument= document;
@@ -823,7 +823,7 @@
         }
         fCurrent.commit();
     }
-    
+
     /*
      * @see dwtx.text.undo.IDocumentUndoManager#reset()
      */
@@ -915,7 +915,7 @@
     /**
      * Fires a document undo event to all registered document undo listeners.
      * Uses a robust iterator.
-     * 
+     *
      * @param offset the document offset
      * @param text the text that was inserted
      * @param preservedText the text being replaced
@@ -955,7 +955,7 @@
     /**
      * Adds the given text edit to the operation history if it is not part of a
      * compound change.
-     * 
+     *
      * @param edit
      *            the edit to be added
      */
@@ -986,7 +986,7 @@
     /**
      * Checks whether the given text starts with a line delimiter and
      * subsequently contains a white space only.
-     * 
+     *
      * @param text the text to check
      * @return <code>true</code> if the text is a line delimiter followed by
      *         whitespace, <code>false</code> otherwise
@@ -1014,7 +1014,7 @@
 
     /**
      * Switches the state of whether there is a text listener or not.
-     * 
+     *
      * @param listen the state which should be established
      */
     private void listenToTextChanges(bool listen) {
@@ -1204,10 +1204,10 @@
 
         addListeners();
     }
-    
+
     /**
      * Reset processChange state.
-     * 
+     *
      * @since 3.2
      */
     private void resetProcessChangeState() {
@@ -1232,7 +1232,7 @@
 
     /**
      * Return whether or not any clients are connected to the receiver.
-     * 
+     *
      * @return <code>true</code> if the receiver is connected to
      *          clients, <code>false</code> if it is not
      */
@@ -1263,11 +1263,11 @@
                 ((UndoableTextChange)op).fDocumentUndoManager= this;
             }
         }
-        
+
         IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext());
         if (op !is null && !(op instanceof UndoableTextChange))
             return;
-        
+
         // Record the transfer itself as an undoable change.
         // If the transfer results from some open operation, recording this change will
         // cause our undo context to be added to the outer operation.  If there is no
@@ -1284,5 +1284,5 @@
         addToOperationHistory(cmd);
     }
 
-    
+
 }