Author: mvw Date: 2010-06-21 04:57:41-0700 New Revision: 18451 Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ActionNewDiagram.java trunk/src/argouml-app/src/org/argouml/uml/ui/ActionStateDiagram.java trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestTransitionNotationUml.java trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesFactory.java trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesHelper.java
Log: Fix for issue 4282: Statemachine should not be owned by a class. Creating a statechart diagram or a activity diagram now correctly puts the statemachine or activitygraph in the namespace that owns the context. This implements WFR 2 of a class for when ArgoUML has to decide on a location for a statemachine. Added more tests to test the implemented code. This fix includes changes to the MDR subsystem - the equivalent EUML operations are not yet implemented at all. TODO: Not all cases are covered - such as operations on imported classes. Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ActionNewDiagram.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ActionNewDiagram.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/ui/ActionNewDiagram.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/ui/ActionNewDiagram.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * bobtarling + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -48,11 +49,11 @@ import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; import org.argouml.model.Model; +import org.argouml.ui.UndoableAction; import org.argouml.ui.explorer.ExplorerEventAdaptor; import org.argouml.ui.targetmanager.TargetManager; import org.argouml.uml.diagram.ArgoDiagram; import org.argouml.uml.diagram.DiagramSettings; -import org.argouml.ui.UndoableAction; /** * Abstract action to trigger creation of a new diagram. <p> @@ -85,7 +86,6 @@ */ @Override public void actionPerformed(ActionEvent e) { - super.actionPerformed(e); // TODO: Get Project or other necessary context from source?? // e.getSource(); @@ -97,8 +97,10 @@ Object ns = findNamespace(); if (ns != null && isValidNamespace(ns)) { - ArgoDiagram diagram = createDiagram(ns, - p.getProjectSettings().getDefaultDiagramSettings()); + super.actionPerformed(e); + DiagramSettings settings = + p.getProjectSettings().getDefaultDiagramSettings(); + ArgoDiagram diagram = createDiagram(ns, settings); assert (diagram != null) : "No diagram was returned by the concrete class"; @@ -115,7 +117,8 @@ } /** - * Find the right namespace for the diagram. + * Find an alternative namespace for the diagram, only to be used + * if the target is not suitable. * * @return the namespace or null */ Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ActionStateDiagram.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ActionStateDiagram.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/ui/ActionStateDiagram.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/ui/ActionStateDiagram.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -96,6 +97,15 @@ machine = Model.getStateMachinesFactory().createStateMachine(); if (Model.getFacade().isANamespace(target)) { namespace = target; + /* Follow well-formedness rule for a Class [2]. + * Determine the owning namespace for the statemachine: */ + while (Model.getFacade().isAClass(namespace)) { + Object parent = Model.getFacade().getNamespace(namespace); + if (parent == null) { + break; + } + namespace = parent; + } } Model.getCoreHelper().setNamespace(machine, namespace); Model.getStateMachinesFactory() @@ -116,9 +126,4 @@ return true; } - /** - * The UID. - */ - private static final long serialVersionUID = -5197718695001757808L; - } Modified: trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java (original) +++ trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -238,7 +239,12 @@ /** * Test deleting a class that contains a Statechart diagram. - * The diagram should be deleted, too. + * According WFR 2 for a class: + * a class should not contain a statemachine. + * Hence, we are testing an abnormal situation. + * But anyhow, deleting a class should cause deletion + * of everything in its namespace. + * Since the statemachine is deleted, the diagram should be deleted, too. */ public void testDeleteClassWithStateDiagram() { Project p = ProjectManager.getManager().getOpenProjects().get(0); @@ -256,6 +262,8 @@ // try with Statediagram Object machine = Model.getStateMachinesFactory().buildStateMachine(aClass); + /* Put the statemachine in the namespace of the class: */ + Model.getCoreHelper().setNamespace(machine, aClass); UMLStateDiagram d = new UMLStateDiagram( Model.getFacade().getNamespace(machine), Modified: trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestTransitionNotationUml.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestTransitionNotationUml.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestTransitionNotationUml.java (original) +++ trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestTransitionNotationUml.java 2010-06-21 04:57:41-0700 @@ -58,9 +58,12 @@ * @author MVW */ public class TestTransitionNotationUml extends TestCase { + private Object model; private Object aClass; + private Object returnType; private Object aStateMachine; private Object aState; + private Object aOper; /** * The constructor. @@ -79,11 +82,11 @@ assertTrue("Model subsystem init failed.", Model.isInitiated()); new InitProfileSubsystem().init(); Project p = ProjectManager.getManager().getCurrentProject(); - Object model = - Model.getModelManagementFactory().createModel(); - aClass = Model.getCoreFactory().buildClass(model); - Object returnType = p.getDefaultReturnType(); - Model.getCoreFactory().buildOperation2(aClass, returnType, "myOper"); + returnType = p.getDefaultReturnType(); + + model = Model.getModelManagementFactory().createModel(); + aClass = Model.getCoreFactory().buildClass("A", model); + aOper = Model.getCoreFactory().buildOperation2(aClass, returnType, "myOper"); aStateMachine = Model.getStateMachinesFactory().buildStateMachine(aClass); Object top = Model.getFacade().getTop(aStateMachine); @@ -399,20 +402,140 @@ /** * Test for the parseTrigger() method: * linking of an Operation for a CallEvent. + * The operation resides on the class that is the context of the + * statemachine: + */ + public void testParseTriggerCallEventOperation1() { + checkLinkingOfOperationToCallEvent("myOper()", aOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * With the operation residing on another class within the same + * namespace: */ - public void testParseTriggerCallEventOperation() { + public void testParseTriggerCallEventOperation2() { + Object bClass = Model.getCoreFactory().buildClass("B", model); + Object bOper = Model.getCoreFactory().buildOperation2(bClass, + returnType, "bOper"); + checkLinkingOfOperationToCallEvent("bOper()", bOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * When the context is a behavioral feature and + * the operation = context: + */ + public void testParseTriggerCallEventOperation3() { + Model.getStateMachinesHelper().setContext(aStateMachine, aOper); + checkLinkingOfOperationToCallEvent("myOper()", aOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * When the context is a behavioral feature and the operation differs + * from the context: + */ + public void testParseTriggerCallEventOperation4() { + Model.getStateMachinesHelper().setContext(aStateMachine, aOper); + Object bClass = Model.getCoreFactory().buildClass("B", model); + Model.getCoreFactory().buildOperation2(bClass, returnType, "cOper"); + Object dOper = Model.getCoreFactory().buildOperation2(bClass, + returnType, "dOper"); + checkLinkingOfOperationToCallEvent("dOper()", dOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * When the context is a package and the operation is on a class + * within that package: + */ + public void testParseTriggerCallEventOperation5() { + Object aPack = Model.getModelManagementFactory().buildPackage("pack1"); + Model.getCoreHelper().setNamespace(aPack, model); + aClass = Model.getCoreFactory().buildClass("A", aPack); + aOper = Model.getCoreFactory().buildOperation2(aClass, returnType, "myOper"); + aStateMachine = + Model.getActivityGraphsFactory().buildActivityGraph(aPack); + + Object top = Model.getFacade().getTop(aStateMachine); + aState = Model.getStateMachinesFactory().buildCompositeState(top); + + Object bClass = Model.getCoreFactory().buildClass("B", aPack); + Model.getCoreFactory().buildOperation2(bClass, returnType, "cOper"); + Object dOper = Model.getCoreFactory().buildOperation2(bClass, + returnType, "dOper"); + checkLinkingOfOperationToCallEvent("dOper()", dOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * When the context is a nested class and the operation is on a class + * within the containing package: + */ + public void testParseTriggerCallEventOperation6() { + Object aPack = Model.getModelManagementFactory().buildPackage("pack1"); + Model.getCoreHelper().setNamespace(aPack, model); + aClass = Model.getCoreFactory().buildClass("A", aPack); + // nested class: + Object bClass = Model.getCoreFactory().buildClass("B", aClass); + Object cClass = Model.getCoreFactory().buildClass("C", bClass); + + aStateMachine = + Model.getActivityGraphsFactory().buildActivityGraph(cClass); + Object top = Model.getFacade().getTop(aStateMachine); + aState = Model.getStateMachinesFactory().buildCompositeState(top); + + Model.getCoreFactory().buildOperation2(cClass, returnType, "cOper"); + Object dOper = Model.getCoreFactory().buildOperation2(aClass, + returnType, "dOper"); + checkLinkingOfOperationToCallEvent("dOper()", dOper); + } + + /** + * Test for the parseTrigger() method: + * linking of an Operation for a CallEvent. + * When the context is a nested class and the operation is on the same + * nested class: + */ + public void testParseTriggerCallEventOperation7() { + Object aPack = Model.getModelManagementFactory().buildPackage("pack1"); + Model.getCoreHelper().setNamespace(aPack, model); + aClass = Model.getCoreFactory().buildClass("A", aPack); + // nested class: + Object bClass = Model.getCoreFactory().buildClass("B", aClass); + Object cClass = Model.getCoreFactory().buildClass("C", bClass); + + aStateMachine = + Model.getActivityGraphsFactory().buildActivityGraph(cClass); + Object top = Model.getFacade().getTop(aStateMachine); + aState = Model.getStateMachinesFactory().buildCompositeState(top); + + Model.getCoreFactory().buildOperation2(cClass, returnType, "cOper"); + Object dOper = Model.getCoreFactory().buildOperation2(cClass, + returnType, "dOper"); + checkLinkingOfOperationToCallEvent("dOper()", dOper); + } + + /** + * This method only uses the "aState" variable. + */ + private void checkLinkingOfOperationToCallEvent(String text, Object operation) { Object trans; Object trig; - String text; Object myOp; - - text = "myOper()"; // this is an existing operation of the class! trans = checkGenerated(aState, text, true, false, false, false); trig = Model.getFacade().getTrigger(trans); assertTrue("Unexpected triggertype found instead of CallEvent for " + text, Model.getFacade().isACallEvent(trig)); myOp = Model.getFacade().getOperation(trig); assertTrue("Operation of CallEvent not linked", myOp != null); + assertTrue("Wrong operation linked to callevent", myOp == operation); } /** Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java (original) +++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -54,6 +55,7 @@ import org.omg.uml.foundation.core.Classifier; import org.omg.uml.foundation.core.ModelElement; import org.omg.uml.foundation.core.Namespace; +import org.omg.uml.foundation.core.UmlClass; /** * Factory to create UML classes for the UML BehaviorialElements::ActivityGraphs @@ -145,12 +147,23 @@ public ActivityGraph buildActivityGraph(Object theContext) { if (theContext instanceof ModelElement) { ActivityGraph myActivityGraph = createActivityGraph(); - myActivityGraph.setContext((ModelElement) theContext); - if (theContext instanceof Namespace) { - myActivityGraph.setNamespace((Namespace) theContext); - } else if (theContext instanceof BehavioralFeature) { - myActivityGraph.setNamespace(((BehavioralFeature) theContext). - getOwner()); + ModelElement modelelement = (ModelElement) theContext; + myActivityGraph.setContext(modelelement); + + if (modelelement instanceof BehavioralFeature) { + modelelement = ((BehavioralFeature) modelelement).getOwner(); + } + if (modelelement instanceof Namespace) { + Namespace namespace = (Namespace) modelelement; + /* Follow well-formedness rule for a Class [2]. + * See issue 4282. Do not use a class + * as the namespace for an activityGraph: */ + while (namespace instanceof UmlClass) { + Namespace pns = namespace.getNamespace(); + if (pns == null) break; + namespace = pns; + } + myActivityGraph.setNamespace(namespace); } State top = (CompositeState) modelImpl.getStateMachinesFactory() Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java (original) +++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -61,10 +62,10 @@ import org.omg.uml.behavioralelements.statemachines.TimeEvent; import org.omg.uml.behavioralelements.statemachines.Transition; import org.omg.uml.foundation.core.BehavioralFeature; -import org.omg.uml.foundation.core.Classifier; import org.omg.uml.foundation.core.ModelElement; import org.omg.uml.foundation.core.Namespace; import org.omg.uml.foundation.core.Operation; +import org.omg.uml.foundation.core.UmlClass; import org.omg.uml.foundation.datatypes.BooleanExpression; import org.omg.uml.foundation.datatypes.PseudostateKindEnum; import org.omg.uml.foundation.datatypes.TimeExpression; @@ -234,14 +235,25 @@ isAddingStatemachineAllowed(oContext))) { StateMachine machine = createStateMachine(); - ModelElement context = (ModelElement) oContext; - machine.setContext(context); - if (context instanceof Classifier) { - machine.setNamespace((Classifier) context); - } else if (context instanceof BehavioralFeature) { - BehavioralFeature feature = (BehavioralFeature) context; - machine.setNamespace(feature.getOwner()); + ModelElement modelelement = (ModelElement) oContext; + machine.setContext(modelelement); + + if (modelelement instanceof BehavioralFeature) { + modelelement = ((BehavioralFeature) modelelement).getOwner(); + } + if (modelelement instanceof Namespace) { + Namespace namespace = (Namespace) modelelement; + /* Follow well-formedness rule for a Class [2]. + * See issue 4282. Do not use a class + * as the namespace for a statemachine: */ + while (namespace instanceof UmlClass) { + Namespace pns = namespace.getNamespace(); + if (pns == null) break; + namespace = pns; + } + machine.setNamespace(namespace); } + State top = buildCompositeStateOnStateMachine(machine); assert top.equals(machine.getTop()); return machine; Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java (original) +++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -41,6 +42,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.List; import javax.jmi.reflect.InvalidObjectException; @@ -63,11 +65,14 @@ import org.omg.uml.behavioralelements.statemachines.Transition; import org.omg.uml.foundation.core.BehavioralFeature; import org.omg.uml.foundation.core.Classifier; +import org.omg.uml.foundation.core.Feature; import org.omg.uml.foundation.core.ModelElement; +import org.omg.uml.foundation.core.Namespace; import org.omg.uml.foundation.core.Operation; import org.omg.uml.foundation.datatypes.BooleanExpression; import org.omg.uml.foundation.datatypes.Expression; import org.omg.uml.foundation.datatypes.TimeExpression; +import org.omg.uml.modelmanagement.UmlPackage; /** * The State Machines Helper Implementation for MDR. @@ -262,14 +267,58 @@ } try { Object sm = getStateMachine(trans); - Object ns = Model.getFacade().getNamespace(sm); - if (ns instanceof Classifier) { - Collection<Operation> operations = - Model.getFacade().getOperations(ns); - for (Operation op : operations) { - String on = ((ModelElement) op).getName(); - if (on.equals(opname)) { - return op; + Object context = Model.getFacade().getContext(sm); + Classifier classifier = null; + if (context instanceof Classifier) { + classifier = (Classifier) context; + } + if (context instanceof BehavioralFeature) { + classifier = ((BehavioralFeature) context).getOwner(); + } + if (classifier != null) { + List<Feature> features = classifier.getFeature(); + for (Feature f : features) { + if (f instanceof Operation) { + String on = f.getName(); + if (on.equals(opname)) { + return f; + } + } + } + } + Namespace pack = null; + if (context instanceof UmlPackage) { + /* according WFR: in case of ActivityGraph only. */ + pack = (Namespace) context; + } else { + if (classifier != null) { + Namespace parent = null; + parent = classifier.getNamespace(); + while (parent instanceof Classifier) { + if (parent.getNamespace() == null) { + break; + } + parent = parent.getNamespace(); + } + if (parent != null) { + pack = parent; + } + } + } + if (pack != null) { + Collection<ModelElement> mes = pack.getOwnedElement(); + for (ModelElement me : mes) { + if (me instanceof Classifier) { + Classifier classifier2 = (Classifier) me; + List<Feature> features = classifier2.getFeature(); + for (Feature f : features) { + if (f instanceof Operation) { + String on = f.getName(); + if (on.equals(opname)) { + return f; + } + } + } } } } Modified: trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesFactory.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesFactory.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesFactory.java (original) +++ trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesFactory.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ******************************************************************************* - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -153,7 +153,8 @@ Object buildCompositeStateOnStateMachine(Object statemachine); /** - * Builds a state machine owned by the given context. + * Builds a state machine with the given context, in the namespace + * containing the context. * * @param oContext the given context * @return MStateMachine the newly build statemachine Modified: trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesHelper.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesHelper.java?view=diff&pathrev=18451&r1=18450&r2=18451 ============================================================================== --- trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesHelper.java (original) +++ trunk/src/argouml-core-model/src/org/argouml/model/StateMachinesHelper.java 2010-06-21 04:57:41-0700 @@ -1,6 +1,6 @@ /* $Id$ ******************************************************************************* - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * tfmorris + * mvw ******************************************************************************* * * Some portions of this file was previously release using the BSD License: @@ -167,14 +168,23 @@ Collection getOutgoingStates(Object ostatevertex); /** - * Finds the operation to which a CallEvent refers. + * Finds the operation to which a CallEvent refers, based on the given + * transition. This function determines the context of the statemachine + * that contains the given transition. If the context is a Classifier, then + * all operations of this classifier are candidates. If the context is a + * BehavioralFeature, then all operations of the owner Classifier are + * candidates. The first operation of which the name matches is the result. + * For Activity diagrams: If the context is a Package, then + * all Operations of all Classifiers in the package are candidates. * TODO: This function works for the most normal cases, * but needs some testing for rare cases, e.g. internal transitions,... + * TODO: The Parameters of the candidates are ignored. Maybe this + * method should return a set of matching operations. * * @author MVW - * @param trans Object of type MTransition + * @param trans Object of type Transition * @param opname the name of the operation sought - * @return Object The operation with the given name, or null. + * @return Object the operation with the given name, or null */ Object findOperationByName(Object trans, String opname); ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2624201 To unsubscribe from this discussion, e-mail: [[email protected]].
