Search in sources :

Example 11 with IConnectable

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

the class ArchimateDiagramConnectionPolicy method getConnectionCreateCommand.

@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    CreateDiagramConnectionCommand cmd = null;
    EClass classType = (EClass) request.getNewObjectType();
    IConnectable source = (IConnectable) getHost().getModel();
    // Plain Connection
    if (classType == IArchimatePackage.eINSTANCE.getDiagramModelConnection()) {
        if (isValidConnectionSource(source, classType)) {
            cmd = new CreateDiagramConnectionCommand(request);
        }
    } else // Archimate Model Component Source
    if (source instanceof IDiagramModelArchimateComponent) {
        if (isValidConnectionSource(source, classType)) {
            cmd = new CreateDiagramArchimateConnectionWithDialogCommand(request);
        }
    }
    if (cmd != null) {
        cmd.setSource(source);
        request.setStartCommand(cmd);
    }
    return cmd;
}
Also used : EClass(org.eclipse.emf.ecore.EClass) IConnectable(com.archimatetool.model.IConnectable) CreateDiagramArchimateConnectionWithDialogCommand(com.archimatetool.editor.diagram.commands.CreateDiagramArchimateConnectionWithDialogCommand) IDiagramModelArchimateComponent(com.archimatetool.model.IDiagramModelArchimateComponent) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Example 12 with IConnectable

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

the class ArchimateDiagramConnectionPolicy method getConnectionCompleteCommand.

@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    IConnectable source = (IConnectable) request.getSourceEditPart().getModel();
    IConnectable target = (IConnectable) getHost().getModel();
    EClass relationshipType = (EClass) request.getNewObjectType();
    CreateDiagramConnectionCommand cmd = null;
    if (isValidConnection(source, target, relationshipType)) {
        // Pick up the command that was created in getConnectionCreateCommand(CreateConnectionRequest request)
        cmd = (CreateDiagramConnectionCommand) request.getStartCommand();
        cmd.setTarget(target);
    }
    return cmd;
}
Also used : IConnectable(com.archimatetool.model.IConnectable) EClass(org.eclipse.emf.ecore.EClass) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Example 13 with IConnectable

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

the class BasicConnectionPolicy method getConnectionCompleteCommand.

@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    IConnectable source = (IConnectable) request.getSourceEditPart().getModel();
    IConnectable target = (IConnectable) getHost().getModel();
    EClass relationshipType = (EClass) request.getNewObjectType();
    CreateDiagramConnectionCommand cmd = null;
    if (isValidConnection(source, target, relationshipType)) {
        // Pick up the command that was created in getConnectionCreateCommand(CreateConnectionRequest request)
        cmd = (CreateDiagramConnectionCommand) request.getStartCommand();
        cmd.setTarget(target);
    }
    return cmd;
}
Also used : IConnectable(com.archimatetool.model.IConnectable) EClass(org.eclipse.emf.ecore.EClass) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Example 14 with IConnectable

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

the class CreateDiagramArchimateConnectionWithDialogCommand method swapSourceAndTargetConcepts.

/**
 * Swap Source and Target Elements - used by Magic Connector
 */
public void swapSourceAndTargetConcepts() {
    IConnectable tmp = fSource;
    fSource = fTarget;
    fTarget = tmp;
}
Also used : IConnectable(com.archimatetool.model.IConnectable)

Aggregations

IConnectable (com.archimatetool.model.IConnectable)14 EClass (org.eclipse.emf.ecore.EClass)5 IDiagramModelArchimateComponent (com.archimatetool.model.IDiagramModelArchimateComponent)4 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)4 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)4 CreateDiagramConnectionCommand (com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)3 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)3 ArrayList (java.util.ArrayList)3 IArchimateConcept (com.archimatetool.model.IArchimateConcept)2 IDiagramModel (com.archimatetool.model.IDiagramModel)2 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)2 IDiagramModelComponent (com.archimatetool.model.IDiagramModelComponent)2 Point (org.eclipse.draw2d.geometry.Point)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 AddDiagramModelReferenceCommand (com.archimatetool.editor.diagram.commands.AddDiagramModelReferenceCommand)1 AddDiagramObjectCommand (com.archimatetool.editor.diagram.commands.AddDiagramObjectCommand)1 CreateDiagramArchimateConnectionWithDialogCommand (com.archimatetool.editor.diagram.commands.CreateDiagramArchimateConnectionWithDialogCommand)1 CreateNestedArchimateConnectionsWithDialogCommand (com.archimatetool.editor.diagram.commands.CreateNestedArchimateConnectionsWithDialogCommand)1 ReconnectDiagramConnectionCommand (com.archimatetool.editor.diagram.commands.ReconnectDiagramConnectionCommand)1