use of com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand 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.editor.diagram.commands.CreateDiagramConnectionCommand 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.editor.diagram.commands.CreateDiagramConnectionCommand in project archi by archimatetool.
the class BasicConnectionPolicy method getConnectionCreateCommand.
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
CreateDiagramConnectionCommand cmd = null;
EClass classType = (EClass) request.getNewObjectType();
IDiagramModelObject source = (IDiagramModelObject) getHost().getModel();
if (isValidConnectionSource(source, classType)) {
cmd = new CreateDiagramConnectionCommand(request);
cmd.setSource(source);
request.setStartCommand(cmd);
}
return cmd;
}
use of com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand 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;
}
Aggregations