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;
}
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;
}
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;
}
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;
}
Aggregations