Author: bobtarling
Date: 2011-07-15 03:50:04-0700
New Revision: 19587

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

Log:
Implementation for setStatemachineAsSubmachine provided by Laurent Braud and 
amended by myself

Modified: 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/StateMachinesHelperEUMLImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/StateMachinesHelperEUMLImpl.java?view=diff&pathrev=19587&r1=19586&r2=19587
==============================================================================
--- 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/StateMachinesHelperEUMLImpl.java
       (original)
+++ 
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/StateMachinesHelperEUMLImpl.java
       2011-07-15 03:50:04-0700
@@ -354,9 +354,18 @@
 
     public void setStatemachineAsSubmachine(Object oSubmachineState,
             Object oStatemachine) {
-        // TODO: Auto-generated method stub
-        throw new NotYetImplementedException();
-
+        if (!(oSubmachineState instanceof State)
+                || !(oStatemachine instanceof StateMachine || oStatemachine == 
null)) {
+            throw new IllegalArgumentException(
+                    "Expected a state and statemachine, got a " //$NON-NLS-1$
+                    + oSubmachineState + " and " + oStatemachine); 
//$NON-NLS-1$
+        }
+        LOG.info("StateMachineHelper setStatemachnieAsSubmachine");
+        State state = (State) oSubmachineState;
+        StateMachine stateMachine = (StateMachine) oStatemachine;
+        ModelEventPumpEUMLImpl pump = (ModelEventPumpEUMLImpl) Model.getPump();
+        pump.addElementForDeleteEventIgnore(state);
+        state.setSubmachine(stateMachine);
     }
 
     public void setSubvertices(Object handle, Collection subvertices) {

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

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

Reply via email to