Author: andreas
Date: 2010-04-22 04:58:40-0700
New Revision: 18325

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

Log:
Added a getBody() implementation for Operations.


Modified: 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&pathrev=18325&r1=18324&r2=18325
==============================================================================
--- 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
    (original)
+++ 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
    2010-04-22 04:58:40-0700
@@ -87,6 +87,7 @@
 import org.eclipse.uml2.uml.Node;
 import org.eclipse.uml2.uml.ObjectFlow;
 import org.eclipse.uml2.uml.ObjectNode;
+import org.eclipse.uml2.uml.OpaqueBehavior;
 import org.eclipse.uml2.uml.OpaqueExpression;
 import org.eclipse.uml2.uml.Operation;
 import org.eclipse.uml2.uml.OutputPin;
@@ -344,7 +345,22 @@
         } else if (handle instanceof ValueSpecification) {
             return getValueSpecification((ValueSpecification) handle);
         } else if (handle instanceof Operation) {
-            throw new NotYetImplementedException();
+           
+           // Get the implementations of this operations and look for an 
OpaqueBehavior.
+           for( Behavior impl : ((Operation)handle).getMethods()) {
+               if( impl instanceof OpaqueBehavior) {
+                   if( ((OpaqueBehavior)impl).isSetLanguages()) {
+                       int bodyIndex = 0;
+                       for( String targetLanguage : 
((OpaqueBehavior)impl).getLanguages()) {
+                           if( "java".equals( targetLanguage)) {
+                               return ((OpaqueBehavior)impl).getBodies().get( 
bodyIndex);
+                           }
+                           bodyIndex++;
+                       }
+                   }
+               }
+           }
+           return null;  // No body found.
         }
         throw new IllegalArgumentException(
                 "Unsupported argument type - must be Comment, Constraint," +

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

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

Reply via email to