Search in sources :

Example 1 with CreateAssignmentCommand

use of org.talend.designer.business.diagram.custom.commands.CreateAssignmentCommand in project tdi-studio-se by Talend.

the class BusinessItemDragDropEditPolicy method getDropObjectsCommand.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy#getDropObjectsCommand(org.eclipse.gmf
     * .runtime.diagram.ui.requests.DropObjectsRequest)
     */
@Override
public Command getDropObjectsCommand(DropObjectsRequest dropObjectsRequest) {
    BusinessItem businessItem = new ElementHelper().getElement(getHost());
    if (businessItem != null) {
        CreateAssignmentCommand createAssignmentCommand = new CreateAssignmentCommand(((IGraphicalEditPart) getHost()).getEditingDomain());
        createAssignmentCommand.setBusinessItem(businessItem);
        createAssignmentCommand.setItems(dropObjectsRequest.getObjects());
        return new ICommandProxy(createAssignmentCommand);
    }
    return UnexecutableCommand.INSTANCE;
}
Also used : ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) CreateAssignmentCommand(org.talend.designer.business.diagram.custom.commands.CreateAssignmentCommand) BusinessItem(org.talend.designer.business.model.business.BusinessItem) ElementHelper(org.talend.designer.business.diagram.custom.util.ElementHelper)

Aggregations

ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)1 CreateAssignmentCommand (org.talend.designer.business.diagram.custom.commands.CreateAssignmentCommand)1 ElementHelper (org.talend.designer.business.diagram.custom.util.ElementHelper)1 BusinessItem (org.talend.designer.business.model.business.BusinessItem)1