svn commit: r13081 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-07-15 09:55:57-0700
New Revision: 13081

Modified:
   branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java

Log:
Added Undo/Redo methods.
It should be supported also in org.argouml.model

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java?view=diff&rev=13081&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java&r1=13080&r2=13081
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/EUMLModelImplementation.java	2007-07-15 09:55:57-0700
@@ -200,6 +200,40 @@
     }
     
     /**
+     * Verifies if the editing domain can undo the last changes in the UML model 
+     * @return true if undo is possible, false otherwise
+     */
+    public boolean canUndo() {
+	return editingDomain.getCommandStack().canUndo();
+    }
+    
+    /**
+     * Verifies if the editing domain can redo the last undone command 
+     * @return true if redo is possible, false otherwise
+     */
+    public boolean canRedo() {
+	return editingDomain.getCommandStack().canRedo();
+    }
+
+    /**
+     * Undo the last command
+     * <p>
+     * If {@link #canUndo()} returns false, nothing will happen
+     */
+    public void undo() {
+	editingDomain.getCommandStack().undo();
+    }
+    
+    /**
+     * Redo the last command
+     * <p>
+     * If {@link #canRedo()} returns false, nothing will happen
+     */
+    public void redo() {
+	editingDomain.getCommandStack().redo();
+    }
+    
+    /**
      * This sets up the editing domain for the model editor.
      */
     private void initializeEditingDomain() {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.