svn commit: r17692 - trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-12-21 00:50:46-0800
New Revision: 17692

Modified:
   trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java

Log:
make removeBaseClass(...) functional

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java?view=diff&pathrev=17692&r1=17691&r2=17692
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsHelperEUMLImpl.java	2009-12-21 00:50:46-0800
@@ -38,6 +38,7 @@
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.uml2.uml.Class;
 import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Extension;
 import org.eclipse.uml2.uml.Model;
 import org.eclipse.uml2.uml.Package;
 import org.eclipse.uml2.uml.Profile;
@@ -101,8 +102,8 @@
                 ((Profile) handle).applyProfile((Profile) profile);
             }
             // also apply subprofiles:
-            Iterator<Package> iter =
-                ((Profile) profile).getNestedPackages().iterator();
+            Iterator<Package> iter = ((Profile) profile).getNestedPackages()
+                    .iterator();
             while (iter.hasNext()) {
                 Package p = iter.next();
                 if (p instanceof Profile) {
@@ -210,8 +211,8 @@
             for (Object ns : models) {
                 if (ns instanceof Profile) {
                     l.addAll(((Profile) ns).getOwnedStereotypes());
-                    Iterator<Package> iter =
-                        ((Profile) ns).getNestedPackages().iterator();
+                    Iterator<Package> iter = ((Profile) ns).getNestedPackages()
+                            .iterator();
                     while (iter.hasNext()) {
                         Package p = iter.next();
                         if (p instanceof Profile) {
@@ -288,11 +289,16 @@
     public void removeBaseClass(Object handle, Object baseClass) {
         if (handle instanceof Stereotype) {
             org.eclipse.uml2.uml.Class metaclass = getMetaclass(baseClass);
-            Profile profile = (Profile) modelImpl.getFacade().getRoot(handle);
+            Profile profile = ((Stereotype) handle).getProfile();
             if (metaclass != null && profile != null) {
                 Stereotype st = (Stereotype) handle;
-                st.getExtension(metaclass.getName());
-                // TODO: remove extension
+                for (Extension ext : profile.getOwnedExtensions(false)) {
+                    if (ext.getMetaclass() == metaclass
+                            && ext.getEndTypes().contains(st)) {
+                        ext.destroy();
+                        break;
+                    }
+                }
                 return;
             }
         }
@@ -336,8 +342,8 @@
                 ((Profile) handle).unapplyProfile((Profile) profile);
             }
             // also unapply subprofiles:
-            Iterator<Package> iter =
-                ((Profile) profile).getNestedPackages().iterator();
+            Iterator<Package> iter = ((Profile) profile).getNestedPackages()
+                    .iterator();
             while (iter.hasNext()) {
                 Package p = iter.next();
                 if (p instanceof Profile) {
@@ -352,8 +358,8 @@
         if (handle instanceof Profile) {
             result = ((Profile) handle).define();
             // also define subprofiles:
-            Iterator<Package> iter =
-                ((Profile) handle).getNestedPackages().iterator();
+            Iterator<Package> iter = ((Profile) handle).getNestedPackages()
+                    .iterator();
             while (iter.hasNext()) {
                 Package p = iter.next();
                 if (p instanceof Profile) {

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

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.