svn commit: r13153 - 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-26 09:27:58-0700
New Revision: 13153

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

Log:
Log undo/redo failed tries and remove the useless listening of CommandStack changes.

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=13153&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=13152&r2=13153
==============================================================================
--- 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-26 09:27:58-0700
@@ -42,7 +42,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
-import java.util.EventObject;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -83,9 +82,6 @@
 import org.argouml.model.XmiReader;
 import org.argouml.model.XmiWriter;
 import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.command.CommandStackListener;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EcorePackage;
 import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -225,6 +221,10 @@
      * If {@link #canUndo()} returns false, nothing will happen
      */
     public void undo() {
+        if (!canUndo()) {
+            LOG.debug("!!! canUndo() == false !!!"); //$NON-NLS-1$
+            return;
+        }
         editingDomain.getCommandStack().undo();
     }
 
@@ -234,6 +234,10 @@
      * If {@link #canRedo()} returns false, nothing will happen
      */
     public void redo() {
+        if (!canRedo()) {
+            LOG.debug("!!! canRedo() == false !!!"); //$NON-NLS-1$
+            return;
+        }
         editingDomain.getCommandStack().redo();
     }
 
@@ -254,26 +258,11 @@
             @Override
             protected void handleError(Exception exception) {
                 super.handleError(exception);
-                exception.printStackTrace();
                 throw new RuntimeException(exception);
             }
 
         };
 
-        commandStack.addCommandStackListener(new CommandStackListener() {
-
-            public void commandStackChanged(final EventObject event) {
-                LOG.debug("Command stack changed"); //$NON-NLS-1$
-                Command mostRecentCommand = 
-                    ((CommandStack) event.getSource()).getMostRecentCommand();
-                if (mostRecentCommand != null) {
-                    LOG.debug("Affected objects: " //$NON-NLS-1$
-                            + mostRecentCommand.getAffectedObjects());
-                }
-            }
-
-        });
-
         if (path == null) {
             // TODO: figure out how to use the ItemProviders - 
             // delayed until the ArgoEclipse version will be out 
@@ -586,7 +575,6 @@
     }
 
     public DiagramInterchangeModel getDiagramInterchangeModel() {
-        // TODO Auto-generated method stub
         return null;
     }
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.