svn commit: r13417 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-08-20 07:58:40-0700
New Revision: 13417

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

Log:
Delete an element using the editing domain

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java?view=diff&rev=13417&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java&r1=13416&r2=13417
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java	2007-08-20 07:58:40-0700
@@ -309,11 +309,20 @@
         return o;
     }
 
-    public void delete(Object elem) {
+    public void delete(final Object elem) {
         if (!(elem instanceof EObject)) {
-            throw new IllegalArgumentException("elem must be instance of EObject"); //$NON-NLS-1$
+            throw new IllegalArgumentException(
+                    "elem must be instance of EObject"); //$NON-NLS-1$
         }
-        EcoreUtil.delete((EObject) elem);
+        RunnableClass run = new RunnableClass() {
+            public void run() {
+                EcoreUtil.delete((EObject) elem);
+            }
+        };
+        modelImpl.getEditingDomain().getCommandStack().execute(
+                new ChangeCommand(
+                        modelImpl, run, "Remove from the model the element #",
+                        elem));
     }
     
     public boolean isRemoved(Object o) {
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.