use of org.talend.designer.business.model.business.BusinessAssignment 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);
}
use of org.talend.designer.business.model.business.BusinessAssignment in project tdi-studio-se by Talend.
the class TalendSVGIDGenerator method generateID.
@Override
public String generateID(String prefix) {
Integer maxId = (Integer) prefixMap.get(prefix);
if (maxId == null) {
maxId = new Integer(0);
prefixMap.put(prefix, maxId);
}
maxId = new Integer(maxId.intValue() + 1);
prefixMap.put(prefix, maxId);
if (svgObject != null && maxId - 1 < svgObject.size() && prefix.equals(SVGSyntax.ID_PREFIX_CLIP_PATH)) {
if (svgObject.get(maxId - 1) != null) {
Object obj = svgObject.get(maxId - 1);
if (obj instanceof BusinessItemShape) {
BusinessItemShape item = (BusinessItemShape) obj;
String id = "";
for (Object assign : item.getAssignments()) {
if (assign instanceof BusinessAssignment) {
BusinessAssignment assignment = (BusinessAssignment) assign;
id = id + assignment.getTalendItem().getLabel() + ";";
}
}
if (id != "") {
id = id.substring(0, id.length() - 1);
return "businessItem." + businessModels.indexOf(obj);
}
}
}
}
return prefix + maxId;
}
use of org.talend.designer.business.model.business.BusinessAssignment in project tdi-studio-se by Talend.
the class BusinessAssignmentComposite method getItemPropertyDescriptor.
private IItemPropertyDescriptor getItemPropertyDescriptor() {
// PTODO mhelleboid find another way to itempropertysource without an eobject
BusinessAssignment sampleBusinessAssignment = BusinessFactory.eINSTANCE.createBusinessAssignment();
EStructuralFeature businessAssignment_Comment = BusinessPackage.eINSTANCE.getBusinessAssignment_Comment();
IItemPropertySource itemPropertySource = EmfPropertyHelper.getItemPropertySource(adapterFactory, sampleBusinessAssignment);
return EmfPropertyHelper.getItemPropertyDescriptor(itemPropertySource, sampleBusinessAssignment, businessAssignment_Comment);
}
use of org.talend.designer.business.model.business.BusinessAssignment in project tdi-studio-se by Talend.
the class ClipboardActionHandler method saveCut.
private void saveCut(ISelection object) {
cutItemIds = new HashMap();
if (object instanceof IStructuredSelection) {
for (Object obj : ((IStructuredSelection) object).toList()) {
if (obj instanceof AbstractEditPart) {
AbstractEditPart editPart = (AbstractEditPart) obj;
EObject element = ((View) editPart.getModel()).getElement();
if (element instanceof BusinessItem) {
BusinessItem businessItem = (BusinessItem) element;
List assignments = new ArrayList();
for (Object assignment : businessItem.getAssignments()) {
BusinessAssignment ba = (BusinessAssignment) assignment;
TalendItem item = ba.getTalendItem();
if (item != null) {
assignments.add(item.getId());
}
}
cutItemIds.put(businessItem, assignments);
}
}
}
}
}
use of org.talend.designer.business.model.business.BusinessAssignment in project tdi-studio-se by Talend.
the class DuplicateAnythingCommand method doExecuteWithResult.
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
// Remove elements whose container is getting copied.
ClipboardSupportUtil.getCopyElements(getObjectsToBeDuplicated());
// Perform the copy and update the references.
EcoreUtil.Copier copier = new EcoreUtil.Copier();
copier.copyAll(getObjectsToBeDuplicated());
copier.copyReferences();
// Update the map with all elements duplicated.
getAllDuplicatedObjectsMap().putAll(copier);
Map targetAndSource = new HashMap();
// Add the duplicates to the original's container.
for (Iterator i = getObjectsToBeDuplicated().iterator(); i.hasNext(); ) {
EObject original = (EObject) i.next();
EObject duplicate = (EObject) copier.get(original);
targetAndSource.put(duplicate, original);
EReference reference = original.eContainmentFeature();
if (reference != null && FeatureMapUtil.isMany(original.eContainer(), reference) && ClipboardSupportUtil.isOkToAppendEObjectAt(original.eContainer(), reference, duplicate)) {
ClipboardSupportUtil.appendEObjectAt(original.eContainer(), reference, duplicate);
}
}
for (Object obj : targetAndSource.keySet()) {
if (obj instanceof BusinessItem) {
BusinessItem item = (BusinessItem) obj;
Object sourceObject = targetAndSource.get(item);
if (sourceObject instanceof BusinessItem) {
BusinessItem sourceItem = (BusinessItem) sourceObject;
List targetAssignments = item.getAssignments();
List sourceAssignments = sourceItem.getAssignments();
for (int i = 0; i < targetAssignments.size() && i < sourceAssignments.size(); i++) {
BusinessAssignment targetAssign = (BusinessAssignment) targetAssignments.get(i);
targetAssign.setComment(((BusinessAssignment) sourceAssignments.get(i)).getComment());
targetAssign.setTalendItem(((BusinessAssignment) sourceAssignments.get(i)).getTalendItem());
}
}
}
}
return null;
}
Aggregations