use of com.archimatetool.model.IArchimateConcept in project archi by archimatetool.
the class ArchimateDiagramEditor method selectArchimateConcepts.
@Override
public void selectArchimateConcepts(IArchimateConcept[] archimateConcepts) {
List<Object> objects = new ArrayList<Object>();
for (IArchimateConcept archimateConcept : archimateConcepts) {
// Find Diagram Concepts
for (IDiagramModelComponent dc : DiagramModelUtils.findDiagramModelComponentsForArchimateConcept(getModel(), archimateConcept)) {
if (!objects.contains(dc)) {
objects.add(dc);
}
}
}
selectObjects(objects.toArray());
}
use of com.archimatetool.model.IArchimateConcept in project archi by archimatetool.
the class ArchimateRelationship method setTarget.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setTarget(IArchimateConcept newTarget) {
IArchimateConcept oldTarget = target;
target = newTarget;
if (oldTarget != null) {
oldTarget.getTargetRelationships().remove(this);
}
if (newTarget != null) {
newTarget.getTargetRelationships().add(this);
}
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IArchimatePackage.ARCHIMATE_RELATIONSHIP__TARGET, oldTarget, target));
}
use of com.archimatetool.model.IArchimateConcept in project archi by archimatetool.
the class ArchimateConcept method getCopy.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EObject getCopy() {
IArchimateConcept newObject = EcoreUtil.copy(this);
// need a new ID
newObject.setId(null);
return newObject;
}
use of com.archimatetool.model.IArchimateConcept in project archi by archimatetool.
the class FieldDataFactory method getFieldValue.
public static Object getFieldValue(Object dataElement, String fieldName) {
if ("this".equals(fieldName)) {
// $NON-NLS-1$
return dataElement;
}
if ("id".equals(fieldName) && dataElement instanceof IIdentifier) {
// $NON-NLS-1$
return ((IIdentifier) dataElement).getId();
}
if ("name".equals(fieldName) && dataElement instanceof INameable) {
// $NON-NLS-1$
String name = ((INameable) dataElement).getName();
if (name == null || "".equals(name)) {
// $NON-NLS-1$
name = ArchiLabelProvider.INSTANCE.getDefaultName(((EObject) dataElement).eClass());
}
return name;
}
if ("type".equals(fieldName) && dataElement instanceof EObject) {
// $NON-NLS-1$
return ArchiLabelProvider.INSTANCE.getDefaultName(((EObject) dataElement).eClass());
}
if ("documentation".equals(fieldName) && dataElement instanceof IDocumentable) {
// $NON-NLS-1$
String s = ((IDocumentable) dataElement).getDocumentation();
return StringUtils.isSet(s) ? s : null;
}
if ("purpose".equals(fieldName) && dataElement instanceof IArchimateModel) {
// $NON-NLS-1$
String s = ((IArchimateModel) dataElement).getPurpose();
return StringUtils.isSet(s) ? s : null;
}
if ("relation_source".equals(fieldName) && dataElement instanceof IArchimateRelationship) {
// $NON-NLS-1$
IArchimateRelationship relation = (IArchimateRelationship) dataElement;
IArchimateConcept source = relation.getSource();
String s = source.getName();
return StringUtils.isSet(s) ? s : null;
}
if ("relation_target".equals(fieldName) && dataElement instanceof IArchimateRelationship) {
// $NON-NLS-1$
IArchimateRelationship relation = (IArchimateRelationship) dataElement;
IArchimateConcept target = relation.getTarget();
String s = target.getName();
return StringUtils.isSet(s) ? s : null;
}
return null;
}
use of com.archimatetool.model.IArchimateConcept in project archi by archimatetool.
the class ArchimateConceptTests method testGetCopy.
@Test
public void testGetCopy() {
concept.setName("name");
concept.setDocumentation("doc");
concept.getProperties().add(IArchimateFactory.eINSTANCE.createProperty());
IArchimateConcept copy = (IArchimateConcept) concept.getCopy();
assertNotSame(concept, copy);
assertNull(copy.getId());
assertEquals(concept.getName(), copy.getName());
assertEquals(concept.getDocumentation(), copy.getDocumentation());
assertNotSame(concept.getProperties(), copy.getProperties());
assertEquals(concept.getProperties().size(), copy.getProperties().size());
assertNotSame(concept.getSourceRelationships(), copy.getSourceRelationships());
assertNotSame(concept.getTargetRelationships(), copy.getTargetRelationships());
}
Aggregations