Author: thn
Date: 2011-05-23 09:12:54-0700
New Revision: 19494

Modified:
   trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java
   
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
   
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
   trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java

Log:
Fix for issue 6280: UML2:Critic failing when calling profiles

Modified: trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java?view=diff&pathrev=19494&r1=19493&r2=19494
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java   
(original)
+++ trunk/src/argouml-app/src/org/argouml/profile/URLModelLoader.java   
2011-05-23 09:12:54-0700
@@ -7,7 +7,8 @@
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *    tfmorris
+ *    Tom Morris
+ *    Thomas Neustupny
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -78,7 +79,7 @@
         }
         
         Collection elements = 
-            Model.getUmlFactory().getExtentPackages(publicId.toExternalForm());
+            Model.getUmlFactory().getExtentElements(publicId.toExternalForm());
         if (elements == null) {
             ZipInputStream zis = null;
             try {

Modified: 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java?view=diff&pathrev=19494&r1=19493&r2=19494
==============================================================================
--- 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
        (original)
+++ 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
        2011-05-23 09:12:54-0700
@@ -24,12 +24,12 @@
 
 import org.apache.log4j.Logger;
 import org.argouml.model.AbstractModelFactory;
+import org.argouml.model.Defaults;
 import org.argouml.model.IllegalModelElementConnectionException;
 import org.argouml.model.InvalidElementException;
 import org.argouml.model.MetaTypes;
 import org.argouml.model.Model;
 import org.argouml.model.UmlFactory;
-import org.argouml.model.Defaults;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.Resource;
@@ -84,7 +84,6 @@
 import org.eclipse.uml2.uml.UMLFactory;
 import org.eclipse.uml2.uml.Usage;
 import org.eclipse.uml2.uml.UseCase;
-import org.eclipse.uml2.uml.Vertex;
 
 /**
  * The implementation of the UmlFactory for EUML2.
@@ -769,7 +768,7 @@
         }
     }
 
-    public Collection getExtentPackages(String extentName) {
+    public Collection getExtentElements(String extentName) {
         if (extentName != null && extentName.startsWith("pathmap://UML_")) {
             // trying to get a built-in standard profile from eclipse UML2
             try {
@@ -784,4 +783,17 @@
         return null;
     }
 
+    public Collection getExtentPackages(String extentName) {
+        Collection elements = getExtentElements(extentName);
+        if (elements != null) {
+            Collection<Object> result = new ArrayList<Object>();
+            for (Object element : elements) {
+                if (element instanceof Package) {
+                    result.add(element);
+                }
+            }
+        }
+        return null;
+    }
+
 }

Modified: 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java?view=diff&pathrev=19494&r1=19493&r2=19494
==============================================================================
--- 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
   (original)
+++ 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
   2011-05-23 09:12:54-0700
@@ -9,6 +9,7 @@
  * Contributors:
  *    Bob Tarling
  *    Luis Sergio Oliveira (euluis)
+ *    Thomas Neustupny
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -1678,6 +1679,10 @@
         }
     }
     
+    public Collection getExtentElements(String name) {
+        return getExtentPackages(name);
+    }
+    
     public Collection getExtentPackages(String name) {
         org.omg.uml.UmlPackage pkg = modelImpl.getExtent(name);
         if (pkg == null) {

Modified: trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java?view=diff&pathrev=19494&r1=19493&r2=19494
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java  
(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java  
2011-05-23 09:12:54-0700
@@ -9,6 +9,7 @@
  * Contributors:
  *    Tom Morris
  *    Bob Tarling
+ *    Thomas Neustupny
  
*******************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -204,6 +205,17 @@
     boolean isRemoved(Object o);
 
     /**
+     * Get the top level elements (only packages in UML 1.x) for the given
+     * extent if it is loaded. Returns null if the extent doesn't exist and an
+     * empty collection if it exists, but contains no elements.
+     * 
+     * @param extentName the extent name (typically the public ID or URL of the
+     *            file which is used for references)
+     * @return a collection of elements if the extent exists, otherwise null
+     */
+    Collection getExtentElements(String extentName);
+
+    /**
      * Get the top level packages (typically just a single Model) for the given
      * extent if it is loaded. Returns null if the extent doesn't exist and an
      * empty collection if it exists, but contains no packages.

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2745973

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to