int x = 0, y = 0;
boolean translateNecessary = false;
if(targetContainer.equals(parent)) {
translateNecessary = true;
ILocation shapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
x = shapeLocation.getX();
y = shapeLocation.getY();
x += context.getDeltaX();
y += context.getDeltaY();
ILocation parentLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(parent);
x += parentLocation.getX();
y += parentLocation.getY();
} else if (targetContainer.equals(sourceContainer)) {
ILocation shapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
x = shapeLocation.getX();
y = shapeLocation.getY();
x += context.getDeltaX();
y += context.getDeltaY();
} else if (targetContainer.equals(secondParent)) {
translateNecessary = true;
ILocation shapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
x = shapeLocation.getX();
y = shapeLocation.getY();
x += context.getDeltaX();
y += context.getDeltaY();
ILocation parentLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(secondParent);
x += parentLocation.getX();
y += parentLocation.getY();
} else {
// not valid
return;
}
if(parent != null) {
ILocation parentLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(parent);
int parentX = parentLocation.getX();
int parentY = parentLocation.getY();
int parentWidth = parent.getGraphicsAlgorithm().getWidth();
int parentHeight = parent.getGraphicsAlgorithm().getHeight();
int EVENT_MAX_OVERLAP = 28;