Search in sources :

Example 1 with CreateDiagramConnectionCommand

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;
}
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 2 with CreateDiagramConnectionCommand

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;
}
Also used : IConnectable(com.archimatetool.model.IConnectable) EClass(org.eclipse.emf.ecore.EClass) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Example 3 with CreateDiagramConnectionCommand

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;
}
Also used : EClass(org.eclipse.emf.ecore.EClass) IDiagramModelObject(com.archimatetool.model.IDiagramModelObject) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Example 4 with CreateDiagramConnectionCommand

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;
}
Also used : IConnectable(com.archimatetool.model.IConnectable) EClass(org.eclipse.emf.ecore.EClass) CreateDiagramConnectionCommand(com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)

Aggregations

CreateDiagramConnectionCommand (com.archimatetool.editor.diagram.commands.CreateDiagramConnectionCommand)4 EClass (org.eclipse.emf.ecore.EClass)4 IConnectable (com.archimatetool.model.IConnectable)3 CreateDiagramArchimateConnectionWithDialogCommand (com.archimatetool.editor.diagram.commands.CreateDiagramArchimateConnectionWithDialogCommand)1 IDiagramModelArchimateComponent (com.archimatetool.model.IDiagramModelArchimateComponent)1 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)1