Search in sources :

Example 1 with ArchimateRelationshipEditPart

use of com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart in project archi by archimatetool.

the class PropertiesLabelProviderTests method testGetImageRelation.

@Test
public void testGetImageRelation() {
    IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
    // Image for relation
    Image image1 = provider.getImage(new StructuredSelection(relation));
    assertNotNull(image1);
    // Image for DiagramModelArchimateConnection
    IDiagramModelArchimateConnection connection = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
    connection.setArchimateRelationship(relation);
    Image image2 = provider.getImage(new StructuredSelection(connection));
    assertSame(image1, image2);
    // Image for EditPart
    EditPart editPart = new ArchimateRelationshipEditPart(AssignmentConnectionFigure.class);
    editPart.setModel(connection);
    Image image3 = provider.getImage(new StructuredSelection(editPart));
    assertSame(image1, image3);
}
Also used : ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) IDiagramModelArchimateConnection(com.archimatetool.model.IDiagramModelArchimateConnection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) NoteEditPart(com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) EditPart(org.eclipse.gef.EditPart) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) Image(org.eclipse.swt.graphics.Image) Test(org.junit.Test)

Example 2 with ArchimateRelationshipEditPart

use of com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart in project archi by archimatetool.

the class PropertiesLabelProviderTests method testGetTextRelation.

@Test
public void testGetTextRelation() {
    // Text for relation
    IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
    relation.setSource(IArchimateFactory.eINSTANCE.createBusinessActor());
    relation.setTarget(IArchimateFactory.eINSTANCE.createBusinessRole());
    relation.getSource().setName("BA1");
    relation.getTarget().setName("BR1");
    String expectedText = "Assignment relation (BA1 - BR1)";
    String text = provider.getText(new StructuredSelection(relation));
    assertEquals(expectedText, text);
    text = provider.getText(new StructuredSelection(relation));
    assertEquals(expectedText, text);
    // Text for DiagramModelArchimateConnection
    IDiagramModelArchimateConnection connection = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
    connection.setArchimateRelationship(relation);
    text = provider.getText(new StructuredSelection(relation));
    assertEquals(expectedText, text);
    // Text for EditPart
    EditPart editPart = new ArchimateRelationshipEditPart(AssignmentConnectionFigure.class);
    editPart.setModel(connection);
    text = provider.getText(new StructuredSelection(editPart));
    assertEquals(expectedText, text);
}
Also used : ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) IDiagramModelArchimateConnection(com.archimatetool.model.IDiagramModelArchimateConnection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) NoteEditPart(com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) EditPart(org.eclipse.gef.EditPart) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) Test(org.junit.Test)

Aggregations

ArchimateElementEditPart (com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart)2 ArchimateRelationshipEditPart (com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart)2 NoteEditPart (com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart)2 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)2 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)2 EditPart (org.eclipse.gef.EditPart)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 Test (org.junit.Test)2 Image (org.eclipse.swt.graphics.Image)1