Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Weigelt2012-03-30 14:28:32 +0000
committerMichael Jastram2012-04-05 10:48:09 +0000
commit2c73da122d7ff43240f7b07771114ac99c4ebe92 (patch)
tree3d1f73bbf1f533193d24421852d1ae15b7ececf4 /org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java
parentd6e94ee9babdf538af25e7605bd4b6856f488130 (diff)
downloadorg.eclipse.rmf-2c73da122d7ff43240f7b07771114ac99c4ebe92.tar.gz
org.eclipse.rmf-2c73da122d7ff43240f7b07771114ac99c4ebe92.tar.xz
org.eclipse.rmf-2c73da122d7ff43240f7b07771114ac99c4ebe92.zip
Fixed Bug 375427 - IF a SpecHierarchy is dropped onto itself, nothing
should happen. Also dropping somewhere within its child hierarchy is forbidden
Diffstat (limited to 'org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java')
-rw-r--r--org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java
index 8755d558..add17017 100644
--- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java
+++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java
@@ -686,4 +686,33 @@ public final class ProrUtil {
}
}
+
+ /**
+ * Helper function for drag and drop operations:
+ * Tests if the element source may be dropped onto the target object.
+ *
+ * @param source
+ * @param target
+ * @return true if the drop should be accepted, false otherwise
+ */
+ public static boolean isValidDrop(SpecHierarchy source, Object target) {
+ if (source == target){
+ return false;
+ }
+
+ if (source.getChildren().contains(target)){
+ return false;
+ }
+
+ for (EObject child : source.getChildren()) {
+ if (child instanceof SpecHierarchy){
+ if (!isValidDrop((SpecHierarchy) child, target)){
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
}

Back to the top