Author: thn
Date: 2011-03-10 08:31:25-0800
New Revision: 19109

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

Log:
a type is optional and can be null

Modified: 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java?view=diff&pathrev=19109&r1=19108&r2=19109
==============================================================================
--- 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java
       (original)
+++ 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java
       2011-03-10 08:31:25-0800
@@ -435,9 +435,13 @@
 
 
     public Property buildAttribute2(final Object handle, final Object type) {
-        if (!(handle instanceof Type) || !(type instanceof Type)) {
+        if (!(handle instanceof Type)) {
             throw new IllegalArgumentException(
-                    "handle and type must be instances of Type."); 
//$NON-NLS-1$
+                    "handle must be instance of Type."); //$NON-NLS-1$
+        }
+        if (type != null && !(type instanceof Type)) {
+            throw new IllegalArgumentException(
+                    "type must be instance of Type."); //$NON-NLS-1$
         }
         if (UMLUtil.getOwnedAttributes((Type) handle) == null) {
             throw new UnsupportedOperationException(
@@ -448,7 +452,9 @@
             public void run() {
                 Property property = createAttribute();
                 UMLUtil.getOwnedAttributes((Type) handle).add(property);
-                property.setType((Type) type);
+                if (type != null) {
+                    property.setType((Type) type);
+                }
                 property.setName("newAttr");
                 getParams().add(property);
             }

Modified: 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java?view=diff&pathrev=19109&r1=19108&r2=19109
==============================================================================
--- 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java
        (original)
+++ 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java
        2011-03-10 08:31:25-0800
@@ -1882,12 +1882,16 @@
             throw new IllegalArgumentException(
                     "handle must be instance of TypedElement"); //$NON-NLS-1$
         }
-        if (!(type instanceof Type)) {
+        if (type != null && !(type instanceof Type)) {
             throw new IllegalArgumentException("type must be instance of 
Type"); //$NON-NLS-1$
         }
         RunnableClass run = new RunnableClass() {
             public void run() {
-                ((TypedElement) handle).setType((Type) type);
+                if (type != null) {
+                    ((TypedElement) handle).setType((Type) type);
+                } else {
+                    ((TypedElement) handle).setType(null);
+                }
             }
         };
         editingDomain.getCommandStack().execute(

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

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to