svn commit: r18333 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-04-25 06:27:11-0700
New Revision: 18333

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java

Log:
Issue 6066 - Allow elements from profiles to be included in classifier list

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java?view=diff&pathrev=18333&r1=18332&r2=18333
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	2010-04-25 06:27:11-0700
@@ -33,6 +33,8 @@
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
 import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.ui.UMLAddDialog;
 import org.argouml.util.ArgoFrame;
@@ -1816,19 +1818,34 @@
             super(target);
         }
 
-
         protected List getChoices() {
             List list = new ArrayList();
             
+            // Get all classifiers in our model
+            // TODO: We need the property panels to have some reference to the
+            // project they belong to instead of using deprecated functionality
             Project p = ProjectManager.getManager().getCurrentProject();
             Object model = p.getRoot();
             list.addAll(Model.getModelManagementHelper()
                     .getAllModelElementsOfKindWithModel(model, Model.getMetaTypes().getClassifier()));
             
+            // Get all classifiers in all top level packages of all profiles
+            for (Profile profile : p.getProfileConfiguration().getProfiles()) {
+        	try {
+		    for (Object topPackage : profile.getProfilePackages()) {
+		            list.addAll(Model.getModelManagementHelper()
+		                    .getAllModelElementsOfKindWithModel(topPackage,
+		                	    Model.getMetaTypes().getClassifier()));
+		    }
+		} catch (ProfileException e) {
+		    // TODO: We need to rethrow this as some other exception
+		    // type but that is too much change for the moment.
+		    LOG.error("Exception", e);
+		}
+            }
             return list;
         }
 
-
         protected List getSelected() {
             List list = new ArrayList();
             list.addAll(Model.getFacade().getClassifiers(getTarget()));

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

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.