use of org.talend.designer.business.model.business.BusinessItem 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;
}
use of org.talend.designer.business.model.business.BusinessItem in project tdi-studio-se by Talend.
the class BusinessItemShapeEditPart method refreshVisuals.
@Override
public void refreshVisuals() {
super.refreshVisuals();
NodeFigure nodeFigure = getNodeFigure();
for (Object obj : nodeFigure.getChildren()) {
if (obj instanceof BusinessItemShapeFigure) {
BusinessItemShapeFigure shapFigure = (BusinessItemShapeFigure) obj;
for (Object figure : shapFigure.getChildren()) {
if (figure instanceof BusinessItemNameFigure) {
BusinessItemNameFigure nameFigure = (BusinessItemNameFigure) figure;
nameFigure.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent me) {
// TODO Auto-generated method stub
}
@Override
public void mouseHover(MouseEvent me) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent me) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent me) {
elementHelper.updateTooltipFigure(getNodeFigure(), tooltipFigure, editPart);
}
@Override
public void mouseDragged(MouseEvent me) {
// TODO Auto-generated method stub
}
});
EObject object = ((Node) getModel()).getElement();
if (object instanceof BusinessItem) {
BusinessItem item = (BusinessItem) object;
String hAlignment = item.getHAlignment();
if (hAlignment == null) {
hAlignment = BusinessAlignment.LEFT.toString();
}
String vAlignment = item.getVAlignment();
if (vAlignment == null) {
vAlignment = BusinessAlignment.TOP.toString();
}
if (BusinessAlignment.HCENTRE.toString().equals(hAlignment)) {
if (BusinessAlignment.TOP.toString().equals(vAlignment)) {
nameFigure.setAlignment(PositionConstants.TOP);
} else if (BusinessAlignment.BOTTOM.toString().equals(vAlignment)) {
nameFigure.setAlignment(PositionConstants.BOTTOM);
} else {
nameFigure.setAlignment(PositionConstants.CENTER);
}
} else if (BusinessAlignment.VCENTRE.toString().equals(vAlignment)) {
if (BusinessAlignment.LEFT.toString().equals(hAlignment)) {
nameFigure.setAlignment(PositionConstants.LEFT);
} else if (BusinessAlignment.RIGHT.toString().equals(hAlignment)) {
nameFigure.setAlignment(PositionConstants.RIGHT);
} else {
nameFigure.setAlignment(PositionConstants.CENTER);
}
} else {
nameFigure.setAlignment(getPosition(hAlignment, BusinessAlignment.HORIZONTAL, item) | getPosition(vAlignment, BusinessAlignment.VERTICAL, item));
}
}
}
}
}
}
elementHelper.updateTooltipFigure(getNodeFigure(), tooltipFigure, this);
}
use of org.talend.designer.business.model.business.BusinessItem 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;
}
use of org.talend.designer.business.model.business.BusinessItem in project tdi-studio-se by Talend.
the class GmfPastCommand method getSortedBusinessItems.
private Collection<BusinessItem> getSortedBusinessItems(List<BusinessItem> items) {
List allBusinessItems = getClonedSourceProcessItemsList();
SortedMap<Integer, BusinessItem> sortedMap = new TreeMap<Integer, BusinessItem>();
if (allBusinessItems != null) {
for (BusinessItem item : items) {
int indexOf = allBusinessItems.indexOf(item);
if (indexOf != -1) {
sortedMap.put(indexOf, item);
}
}
}
return sortedMap.values();
}
Aggregations