svn commit: r19392 - trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2011-05-10 10:28:55-0700
New Revision: 19392

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java

Log:
UML2: just check applied profiles for stereotypes (don't search outside profiles)

Modified: trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java?view=diff&pathrev=19392&r1=19391&r2=19392
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/StereotypeUtility.java	2011-05-10 10:28:55-0700
@@ -122,46 +122,49 @@
         Set<List> paths = new HashSet<List>();
         Set<Object> availableStereotypes = new TreeSet<Object>(
                 new PathComparator());
-        Collection models = ProjectManager.getManager().getCurrentProject()
-                .getModels();
 
-        Collection topLevelModels = ProjectManager.getManager()
-                .getCurrentProject().getModels();
+        if (Model.getFacade().getUmlVersion().charAt(0) == '1') {
 
-        // adds all stereotypes defined at the top level namespaces
-        Collection topLevelStereotypes = getTopLevelStereotypes(topLevelModels);
+            Collection models = ProjectManager.getManager().getCurrentProject()
+                    .getModels();
 
-        Collection validTopLevelStereotypes = new ArrayList();
-
-        addAllUniqueModelElementsFrom(
-                availableStereotypes,
-                paths,
-                Model.getExtensionMechanismsHelper().getAllPossibleStereotypes(
-                        models, modelElement));
-        for (Object stereotype : topLevelStereotypes) {
-            if (Model.getExtensionMechanismsHelper().isValidStereotype(
-                    modelElement, stereotype)) {
-                validTopLevelStereotypes.add(stereotype);
-            }
-        }
+            Collection topLevelModels = ProjectManager.getManager()
+                    .getCurrentProject().getModels();
 
-        addAllUniqueModelElementsFrom(availableStereotypes, paths,
-                validTopLevelStereotypes);
+            // adds all stereotypes defined at the top level namespaces
+            Collection topLevelStereotypes = getTopLevelStereotypes(topLevelModels);
 
-        // adds all stereotypes defined at the profiles applied to the
-        // current namespace
-        Object namespace = Model.getFacade().getNamespace(modelElement);
-        if (namespace != null) {
-            while (true) {
-                getApplicableStereotypesInNamespace(modelElement, paths,
-                        availableStereotypes, namespace);
-                Object newNamespace = Model.getFacade().getNamespace(namespace);
+            Collection validTopLevelStereotypes = new ArrayList();
 
-                if (newNamespace == null) {
-                    break;
+            addAllUniqueModelElementsFrom(availableStereotypes, paths,
+                    Model.getExtensionMechanismsHelper()
+                            .getAllPossibleStereotypes(models, modelElement));
+            for (Object stereotype : topLevelStereotypes) {
+                if (Model.getExtensionMechanismsHelper().isValidStereotype(
+                        modelElement, stereotype)) {
+                    validTopLevelStereotypes.add(stereotype);
                 }
+            }
+
+            addAllUniqueModelElementsFrom(availableStereotypes, paths,
+                    validTopLevelStereotypes);
 
-                namespace = newNamespace;
+            // adds all stereotypes defined at the profiles applied to the
+            // current namespace
+            Object namespace = Model.getFacade().getNamespace(modelElement);
+            if (namespace != null) {
+                while (true) {
+                    getApplicableStereotypesInNamespace(modelElement, paths,
+                            availableStereotypes, namespace);
+                    Object newNamespace = Model.getFacade().getNamespace(
+                            namespace);
+
+                    if (newNamespace == null) {
+                        break;
+                    }
+
+                    namespace = newNamespace;
+                }
             }
         }

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

To unsubscribe from this discussion, e-mail: [[email protected]].
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.