Search in sources :

Example 1 with IDiagramModelConnection

use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.

the class DiagramModelConnectionTests method testGetCopy.

@Override
@Test
public void testGetCopy() {
    connection.connect(source, target);
    connection.getProperties().add(IArchimateFactory.eINSTANCE.createProperty());
    IDiagramModelConnection copy = (IDiagramModelConnection) connection.getCopy();
    assertNotSame(target, copy);
    assertNotSame(connection.getProperties(), copy.getProperties());
    assertEquals(connection.getProperties().size(), copy.getProperties().size());
    assertNotSame(connection.getBendpoints(), copy.getBendpoints());
    assertNull(copy.getSource());
    assertNull(copy.getTarget());
    assertEquals(connection.getDocumentation(), copy.getDocumentation());
    assertEquals(connection.getType(), copy.getType());
}
Also used : IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) Test(org.junit.Test)

Example 2 with IDiagramModelConnection

use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.

the class DiagramModelObjectTests method testRemoveConnection.

@Test
public void testRemoveConnection() {
    IDiagramModelConnection conn = IArchimateFactory.eINSTANCE.createDiagramModelConnection();
    conn.connect(object, object);
    object.addConnection(conn);
    assertTrue(object.getSourceConnections().contains(conn));
    assertTrue(object.getTargetConnections().contains(conn));
    // Try to remove bogus connection
    IDiagramModelConnection conn2 = IArchimateFactory.eINSTANCE.createDiagramModelConnection();
    conn2.connect(IArchimateFactory.eINSTANCE.createDiagramModelNote(), IArchimateFactory.eINSTANCE.createDiagramModelNote());
    object.removeConnection(conn2);
    assertTrue(object.getSourceConnections().contains(conn));
    assertTrue(object.getTargetConnections().contains(conn));
    // Now do it properly
    object.removeConnection(conn);
    assertTrue(object.getSourceConnections().isEmpty());
    assertTrue(object.getTargetConnections().isEmpty());
}
Also used : IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) Test(org.junit.Test)

Example 3 with IDiagramModelConnection

use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.

the class DiagramModelObjectTests method testGetSourceConnections.

@Test
public void testGetSourceConnections() {
    assertTrue(object.getSourceConnections().isEmpty());
    IDiagramModelConnection conn = IArchimateFactory.eINSTANCE.createDiagramModelConnection();
    object.getSourceConnections().add(conn);
    assertSame(conn, object.getSourceConnections().get(0));
}
Also used : IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) Test(org.junit.Test)

Example 4 with IDiagramModelConnection

use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.

the class DiagramModelObjectTests method testGetTargetConnections.

@Test
public void testGetTargetConnections() {
    assertTrue(object.getTargetConnections().isEmpty());
    IDiagramModelConnection conn = IArchimateFactory.eINSTANCE.createDiagramModelConnection();
    object.getTargetConnections().add(conn);
    assertSame(conn, object.getTargetConnections().get(0));
}
Also used : IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) Test(org.junit.Test)

Example 5 with IDiagramModelConnection

use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.

the class DiagramConnectionSection method refreshLineWidthCombo.

protected void refreshLineWidthCombo() {
    if (fIsExecutingCommand) {
        return;
    }
    IDiagramModelConnection lastSelectedConnection = (IDiagramModelConnection) getFirstSelectedObject();
    int lineWidth = lastSelectedConnection.getLineWidth();
    fComboLineWidth.select(lineWidth - 1);
    fComboLineWidth.setEnabled(!isLocked(lastSelectedConnection));
}
Also used : IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection)

Aggregations

IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)34 Test (org.junit.Test)15 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)10 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)7 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)6 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)6 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)5 Command (org.eclipse.gef.commands.Command)5 IArchimateElement (com.archimatetool.model.IArchimateElement)4 IConnectable (com.archimatetool.model.IConnectable)4 IDiagramModel (com.archimatetool.model.IDiagramModel)4 EditPart (org.eclipse.gef.EditPart)4 ReconnectDiagramConnectionCommand (com.archimatetool.editor.diagram.commands.ReconnectDiagramConnectionCommand)3 EmptyEditPart (com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart)3 ArrayList (java.util.ArrayList)3 ConnectionTextPositionCommand (com.archimatetool.editor.diagram.commands.ConnectionTextPositionCommand)2 LineWidthCommand (com.archimatetool.editor.diagram.commands.LineWidthCommand)2 DiagramConnectionEditPart (com.archimatetool.editor.diagram.editparts.DiagramConnectionEditPart)2 DeleteArchimateElementCommand (com.archimatetool.editor.model.commands.DeleteArchimateElementCommand)2 DeleteArchimateRelationshipCommand (com.archimatetool.editor.model.commands.DeleteArchimateRelationshipCommand)2