svn commit: r18919 - trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2010-12-12 07:06:40-0800
New Revision: 18919

Modified:
   trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java

Log:
UML2 only: automatically enable referenced profiles when updating project roots (e.g. when loading a model from XMI)

Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java?view=diff&pathrev=18919&r1=18918&r2=18919
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java	2010-12-12 07:06:40-0800
@@ -994,6 +994,7 @@
             for (Object e : Model.getModelManagementHelper().getRootElements(m)) {
                 if (!roots.contains(e)) {
                     roots.add(e);
+                    checkProfileFor(e);
                 }
             }
         }
@@ -1148,4 +1149,19 @@
         dirty = isDirty;
         ProjectManager.getManager().setSaveEnabled(isDirty);
     }
+
+    private void checkProfileFor(Object o) {
+        Profile profile = null;
+        if (Model.getFacade().isAAppliedProfileElement(o)) {
+            Object pkg = Model.getFacade().getNamespace(o);
+            if (pkg != null) {
+                String name = Model.getFacade().getName(pkg);
+                profile = ProfileFacade.getManager()
+                        .lookForRegisteredProfile(name);
+            }
+        }
+        if (profile != null) {
+            getProfileConfiguration().addProfile(profile, null);
+        }
+    }
 }

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

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.