for (Diagram myDiagram : myModel.getInstances(UMLPackage.Literals.DIAGRAM)) { ... }
SemanticModelBridge bridge = myDiagram.getSemanticModel(); if (bridge instanceof SimpleSemanticModelElement) { return ((SimpleSemanticModelElement) bridge).getTypeInfo(); }
Diagram umlDiagram = model.create(UMLPackage.Literals.DIAGRAM); umlDiagram.setSemanticTypeInfo(UMLDiagramKind.CLASS_DIAGRAM.getLiteral());All UML Diagram kinds are available in the Class
com.sodius.mdw.metamodel.uml21.xmi.di.UMLDiagramKind
.
Here are sample codes that show how to manage GraphNodes of a Diagram.
for (GraphNode umlGraphNode : umlDiagram.getContainedNodes()) { ... }
for (GraphNode umlGraphNode : umlDiagram.getContainedNodes("DiagramFrame")) { ... }
com.sodius.mdw.metamodel.uml21.Class myClass = umlDiagram.eModel().<com.sodius.mdw.metamodel.uml21.Class>getInstances(UMLPackage.Literals.CLASS).detect(UMLPackage.Literals.NAMED_ELEMENT__NAME, "myClass1"); for (GraphNode umlGraphNode : umlDiagram.getContainedNodes(myClass)) { ... }
for (Class myClass : umlDiagram.eModel().<com.sodius.mdw.metamodel.uml21.Class>getInstances(UMLPackage.Literals.CLASS)) { for (GraphNode umlGraphNode : umlDiagram.getAllContainedNodes(myClass)) { ... } }or
for (GraphNode umlGraphNode : umlDiagram.getAllContainedNodes(UMLPackage.Literals.CLASS)) { ... }
com.sodius.mdw.metamodel.uml21.Class myClass = umlDiagram.eModel().<com.sodius.mdw.metamodel.uml21.Class>getInstances(UMLPackage.Literals.CLASS).detect(UMLPackage.Literals.NAMED_ELEMENT__NAME, "myClass1"); if(myClass!=null){ for (GraphNode umlGraphNode : umlDiagram.getAllContainedNodes(myClass)) { ... } }
Element myElement = umlGraphNode.getSemanticElement();
GraphNode umlNode = umlDiagram.createContainedNode(class_); umlNode.setPosition(posX, posY); umlNode.setSize(width, height);
for (GraphEdge umlGraphEdge : umlDiagram.getContainedEdges()) { ... }
com.sodius.mdw.metamodel.uml21.InformationFlow myInfo = umlDiagram.eModel().<com.sodius.mdw.metamodel.uml21.InformationFlow>getInstances(UMLPackage.Literals.INFORMATION_FLOW).detect(UMLPackage.Literals.NAMED_ELEMENT__NAME, "myInfo1"); if(myInfo!=null){ for (GraphEdge umlGraphEdge : umlDiagram.getContainedEdges(myInfo)) { ... } }
for (InformationFlow myInfo : umlDiagram.eModel().<com.sodius.mdw.metamodel.uml21.InformationFlow>getInstances(UMLPackage.Literals.INFORMATION_FLOW)) { for (GraphEdge umlGraphEdge : umlDiagram.getAllContainedEdges(myInfo)) { ... } }or
for (GraphEdge umlGraphEdge : umlDiagram.getAllContainedEdges(UMLPackage.Literals.INFORMATION_FLOW)) { ... }
Element myElement = umlGraphEdge.getSemanticElement();
GraphEdge umlEdge = umlDiagram.createContainedEdge(composition);
GraphNode umlFirstNode = umlGraphEdge.getFirstNode(); GraphNode umlLastNode = umlGraphEdge.getLastNode();
GraphConnector firstConnector = model.create(UMLPackage.Literals.GRAPH_CONNECTOR); sysmlEdge.getAnchor().add(fistConnector); firstConnector.setGraphElement(sourceNode); GraphConnector lastConnector = model.create(UMLPackage.Literals.GRAPH_CONNECTOR); sysmlEdge.getAnchor().add(lastConnector); lastConnector.setGraphElement(targetNode);