svn commit: r13264 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-08-07 07:20:20-0700
New Revision: 13264

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

Log:
Implemented getAllContents()

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java?view=diff&rev=13264&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java&r1=13263&r2=13264
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelManagementHelperEUMLImpl.java	2007-08-07 07:20:20-0700
@@ -33,11 +33,12 @@
 import java.util.Vector;
 
 import org.argouml.model.ModelManagementHelper;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Collaboration;
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.NamedElement;
 import org.eclipse.uml2.uml.Namespace;
 
-
 /**
  * The implementation of the ModelManagementHelper for EUML2.
  */
@@ -52,10 +53,9 @@
      * Constructor.
      * 
      * @param implementation
-     *            The ModelImplementation.
+     *                The ModelImplementation.
      */
-    public ModelManagementHelperEUMLImpl(
-            EUMLModelImplementation implementation) {
+    public ModelManagementHelperEUMLImpl(EUMLModelImplementation implementation) {
         modelImpl = implementation;
     }
 
@@ -71,9 +71,20 @@
 
     public Collection getAllContents(Object element) {
         if (!(element instanceof Element)) {
-            throw new IllegalArgumentException("The argument must be instance of Element"); //$NON-NLS-1$
+            throw new IllegalArgumentException(
+                    "The argument must be instance of Element"); //$NON-NLS-1$
+        }
+        Collection result = new HashSet();
+        if (element instanceof Collaboration) {
+            // TODO: implement
+        }
+        if (element instanceof Classifier) {
+            result.addAll(((Classifier) element).allFeatures());
         }
-        return ((Element) element).allOwnedElements();
+        if (element instanceof Namespace) {
+            result.addAll(((Namespace) element).getOwnedMembers());
+        }
+        return result;
     }
 
     public Collection getAllImportedElements(Object pack) {
@@ -121,13 +132,12 @@
     private boolean contained(Object container, Object candidate) {
         Object current = candidate;
         while (current != null) {
-            if (container.equals(current))
-                return true;
+            if (container.equals(current)) return true;
             current = modelImpl.getFacade().getModelElementContainer(current);
         }
         return false;
     }
-    
+
     public Collection getAllModelElementsOfKind(Object nsa, String kind) {
         return getAllModelElementsOfKind(nsa, kind);
     }
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.