Skip to content
Snippets Groups Projects
Commit 14d7d66e authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

makes use of isAncestor to compute the right parent

refs 2955
parent 863d9661
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ $Id$
package org.fortiss.tooling.base.ui.editpart.command;
import static org.fortiss.tooling.base.ui.utils.DragAndDropBaseUtils.setConnectionDragContextTarget;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.isAncestor;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
......@@ -36,7 +37,7 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: F7D3596F1BC65D2B558627125DCB05AA
* @ConQAT.Rating YELLOW Hash: 22616D8ACADDDEB341A7C1A4B47C75D3
*/
public class ConnectCommand extends Command {
......@@ -89,12 +90,13 @@ public class ConnectCommand extends Command {
if(sourceParent == targetParent) {
return sourceParent;
}
if(sourceParent.eContainer() == targetParent) {
if(isAncestor(sourceParent, targetParent)) {
return targetParent;
}
if(sourceParent == targetParent.eContainer())
if(isAncestor(targetParent, sourceParent)) {
return sourceParent;
}
return sourceParent.eContainer();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment