svn commit: r17413 - trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsFactoryEUMLImpl.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-10-19 10:00:26-0700
New Revision: 17413

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

Log:
intermediate state for some stereotype builders

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsFactoryEUMLImpl.java?view=diff&pathrev=17413&r1=17412&r2=17413
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsFactoryEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ExtensionMechanismsFactoryEUMLImpl.java	2009-10-19 10:00:26-0700
@@ -30,6 +30,9 @@
 
 import org.argouml.model.AbstractModelFactory;
 import org.argouml.model.ExtensionMechanismsFactory;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Stereotype;
 import org.eclipse.uml2.uml.UMLFactory;
 
 /**
@@ -56,8 +59,35 @@
 
     public Object buildStereotype(Object theModelElementObject, Object theName,
             Object theNamespaceObject) {
-        // TODO: Auto-generated method stub
-        return null;
+        
+        if (theModelElementObject == null || theName == null
+                || theNamespaceObject == null) {
+            throw new IllegalArgumentException(
+                    "one of the arguments is null: modelElement=" //$NON-NLS-1$
+                    + theModelElementObject
+                    + " name=" + theName //$NON-NLS-1$
+                    + " namespace=" + theNamespaceObject); //$NON-NLS-1$
+        }
+        
+        //ModelElement me = (ModelElement) theModelElementObject;
+        
+        String text = (String) theName;
+        Namespace ns = (Namespace) theNamespaceObject;
+        Stereotype stereo = (Stereotype)buildStereotype(text, ns);
+        /*
+        stereo.getBaseClass().add(modelImpl.getMetaTypes().getName(me));
+        // TODO: this doesn't look right - review - tfm
+        Stereotype stereo2 = (Stereotype) extensionHelper.getStereotype(ns,
+                stereo);
+        if (stereo2 != null) {
+            me.getStereotype().add(stereo2);
+            modelImpl.getUmlFactory().delete(stereo);
+            return stereo2;
+        }
+        stereo.setNamespace(ns);
+        me.getStereotype().add(stereo);
+        */
+        return stereo;
     }
 
     public Object buildStereotype(Object theModelElementObject, String theName,
@@ -67,8 +97,13 @@
     }
 
     public Object buildStereotype(String text, Object ns) {
-        // TODO: Auto-generated method stub
-        return null;
+        Stereotype stereo = UMLFactory.eINSTANCE.createStereotype();
+        stereo.setName(text);
+        // more checking needed?
+        if (ns instanceof Package) {
+            stereo.setPackage((Package)ns);
+        }
+        return stereo;
     }
 
     public Object buildTagDefinition(String name, Object stereotype, Object ns) {

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

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.