svn commit: r13097 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-07-18 23:33:03-0700
New Revision: 13097

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

Log:
Fixed the undo/redo notification.
If a UML container is not affiliated with a Resource then undo/redo doesn't fire notifications.

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java?view=diff&rev=13097&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java&r1=13096&r2=13097
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementFactoryEUMLImpl.java	2007-07-18 23:33:03-0700
@@ -29,6 +29,8 @@
 import org.argouml.model.AbstractModelFactory;
 import org.argouml.model.ModelManagementFactory;
 import org.argouml.model.NotImplementedException;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.edit.domain.EditingDomain;
 import org.eclipse.uml2.uml.ElementImport;
 import org.eclipse.uml2.uml.Model;
@@ -112,7 +114,14 @@
 		    "The rootModel supplied must be a Package. Got a "
 			    + rootModel.getClass().getName());
 	}
+	if (theRootModel != null && theRootModel.eResource() != null) {
+	    EcoreUtil.remove(theRootModel);
+	}
 	theRootModel = (org.eclipse.uml2.uml.Package) rootModel;
+	if (rootModel != null) {
+	    Resource r = editingDomain.createResource("http://argouml.tigris.org/euml/resource/default_uri.xmi"); //$NON-NLS-1$
+	    r.getContents().add(theRootModel);
+	}
 	modelImpl.getModelEventPump().setRootContainer(theRootModel);
     }
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.