use of com.archimatetool.model.IDiagramModel in project archi by archimatetool.
the class SelectElementInTreeAction method run.
@Override
public void run() {
List<?> selection = getSelectedObjects();
List<Object> elements = new ArrayList<Object>();
for (Object object : selection) {
if (object instanceof EditPart) {
Object model = ((EditPart) object).getModel();
if (model instanceof IDiagramModel) {
elements.add(model);
} else if (model instanceof IDiagramModelArchimateComponent) {
elements.add(((IDiagramModelArchimateComponent) model).getArchimateConcept());
}
}
}
ITreeModelView view = (ITreeModelView) ViewManager.showViewPart(ITreeModelView.ID, true);
if (view != null) {
view.getViewer().setSelection(new StructuredSelection(elements), true);
}
}
use of com.archimatetool.model.IDiagramModel in project archi by archimatetool.
the class DiagramModel method getCopy.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EObject getCopy() {
IDiagramModel newDiagramModel = EcoreUtil.copy(this);
// need a new ID
newDiagramModel.setId(null);
// need to do this!
newDiagramModel.getChildren().clear();
return newDiagramModel;
}
use of com.archimatetool.model.IDiagramModel in project archi by archimatetool.
the class DiagramModelReference method setReferencedModel.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReferencedModel(IDiagramModel newReferencedModel) {
IDiagramModel oldReferencedModel = referencedModel;
referencedModel = newReferencedModel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IArchimatePackage.DIAGRAM_MODEL_REFERENCE__REFERENCED_MODEL, oldReferencedModel, referencedModel));
}
use of com.archimatetool.model.IDiagramModel in project archi by archimatetool.
the class DiagramModelUtilsTests method findDiagramModelComponentsForArchimateConcept_Element.
@Test
public void findDiagramModelComponentsForArchimateConcept_Element() {
IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
IDiagramModel diagramModel = tm.addNewArchimateDiagramModel();
// Should not be found
List<IDiagramModelArchimateComponent> list = DiagramModelUtils.findDiagramModelComponentsForArchimateConcept(diagramModel, element);
assertTrue(list.isEmpty());
// Add the element to various IDiagramModelArchimateObject objects
createDataForDiagramModelArchimateObjects(element, diagramModel);
// Should be found in diagram
list = DiagramModelUtils.findDiagramModelComponentsForArchimateConcept(diagramModel, element);
assertEquals(4, list.size());
assertTrue(list.contains(dmo1));
assertTrue(list.contains(dmo2));
assertTrue(list.contains(dmo3));
assertTrue(list.contains(dmo4));
}
use of com.archimatetool.model.IDiagramModel in project archi by archimatetool.
the class DiagramModelUtilsTests method findDiagramModelConnectionsForRelation.
@Test
public void findDiagramModelConnectionsForRelation() {
IArchimateRelationship relationship = IArchimateFactory.eINSTANCE.createAssociationRelationship();
IDiagramModel diagramModel = tm.addNewArchimateDiagramModel();
// Should not be found
List<IDiagramModelArchimateConnection> list = DiagramModelUtils.findDiagramModelConnectionsForRelation(diagramModel, relationship);
assertTrue(list.isEmpty());
// Create various IDiagramModelArchimateObject objects
createDataForDiagramModelArchimateObjects(IArchimateFactory.eINSTANCE.createBusinessActor(), diagramModel);
// And make some connections using the relationship
createDataForDiagramModelConnections(relationship);
// Should be found in a dm
list = DiagramModelUtils.findDiagramModelConnectionsForRelation(diagramModel, relationship);
assertEquals(3, list.size());
}
Aggregations