Search in sources :

Example 1 with UnassignTalendItemsFromBusinessAssignmentCommand

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

the class AssignmentPropertySection method executeDeleteCommand.

private void executeDeleteCommand(IStructuredSelection structuredSelection) {
    UnassignTalendItemsFromBusinessAssignmentCommand command = new UnassignTalendItemsFromBusinessAssignmentCommand(getEditingDomain(), true);
    for (Iterator iter = structuredSelection.iterator(); iter.hasNext(); ) {
        Object object = (Object) iter.next();
        if (object instanceof BusinessAssignment) {
            BusinessAssignment businessAssignment = (BusinessAssignment) object;
            command.addBusinessAssignment(businessAssignment);
        }
    }
    List<ICommand> commands = new ArrayList<ICommand>();
    commands.add(command);
    //$NON-NLS-1$
    executeAsCompositeCommand(Messages.getString("AssignmentPropertySection.DeleteAssignment"), commands);
}
Also used : BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) UnassignTalendItemsFromBusinessAssignmentCommand(org.talend.designer.business.diagram.custom.commands.UnassignTalendItemsFromBusinessAssignmentCommand) ICommand(org.eclipse.gmf.runtime.common.core.command.ICommand) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 2 with UnassignTalendItemsFromBusinessAssignmentCommand

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

the class BusinessBaseEditHelper method getDestroyElementCommand.

/**
     * @generated NOT
     */
protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
    if (req.getElementToDestroy() != null) {
        if (req.getElementToDestroy() instanceof BusinessItem) {
            BusinessItem businessItem = (BusinessItem) req.getElementToDestroy();
            if (businessItem.getAssignments().size() > 0) {
                UnassignTalendItemsFromBusinessAssignmentCommand command = new UnassignTalendItemsFromBusinessAssignmentCommand(req.getEditingDomain(), false);
                for (Iterator iter = businessItem.getAssignments().iterator(); iter.hasNext(); ) {
                    BusinessAssignment businessAssignment = (BusinessAssignment) iter.next();
                    command.addBusinessAssignment(businessAssignment);
                }
                return command;
            }
        }
    }
    return null;
}
Also used : BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) UnassignTalendItemsFromBusinessAssignmentCommand(org.talend.designer.business.diagram.custom.commands.UnassignTalendItemsFromBusinessAssignmentCommand) Iterator(java.util.Iterator) BusinessItem(org.talend.designer.business.model.business.BusinessItem)

Aggregations

Iterator (java.util.Iterator)2 UnassignTalendItemsFromBusinessAssignmentCommand (org.talend.designer.business.diagram.custom.commands.UnassignTalendItemsFromBusinessAssignmentCommand)2 BusinessAssignment (org.talend.designer.business.model.business.BusinessAssignment)2 ArrayList (java.util.ArrayList)1 ICommand (org.eclipse.gmf.runtime.common.core.command.ICommand)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 BusinessItem (org.talend.designer.business.model.business.BusinessItem)1