I want to generate an activity diagram from my external java program. My problem now is to add a structured activity (with a sub-activitydiagram).
This is my code:
//Add the structured activity to the package
Element structActivityElement= elements.AddNew("My Structured Activity","Activity");
structActivityElement.SetSubtype(8);
//add activitydiagram to the structured activity
Diagram newDiagram = structActivityElement.GetDiagrams().AddNew("SubActivityDiagram", "Activity");
newDiagram.Update();
structActivityElement.Update();
elements.Refresh();
//Add the element to the root activity diagram
DiagramObject dob = dobs.AddNew("", "");
dobs.Refresh();
//reference the DiagramObject to the before created element
dob.SetElementID(element.GetElementID());
dob.Update();
dobs.Refresh();
After running this I see only a normal activity in Enterprise Architect. Usually when I doubleclick on a structured activity it appears the sub-activitydiagram, but when I doubleclick at this generated Activity nothing happens. Anybody has an idea?
The Element Class has the attribute "CompositeDiagram". But there's no method like
setCompositeDiagram()
Regards