aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarwa rostren2014-01-29 06:56:50 (EST)
committerEd Willink2014-03-06 10:07:28 (EST)
commitcfb413d6db798b562f76add45acf2d41bbbb9c31 (patch)
treeb395a76dd9f89eb934ddda309437fbcd2b879c27
parentd98fe15fbd77d32ff8cd3d034bdbedb66b781301 (diff)
downloadorg.eclipse.ocl-cfb413d6db798b562f76add45acf2d41bbbb9c31.zip
org.eclipse.ocl-cfb413d6db798b562f76add45acf2d41bbbb9c31.tar.gz
org.eclipse.ocl-cfb413d6db798b562f76add45acf2d41bbbb9c31.tar.bz2
[425799] Propagate checked/uncheked to adjacent tree.
This propagates checked/uncheked to the element and to its ancestors in the adjacent tree. Change-Id: I61ac6e7e650fbbacbfb72b6553cfe0417e176425 Signed-off-by: marwa rostren <mrostren@obeo.fr>
-rw-r--r--emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityNodeCheckStateListener.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityNodeCheckStateListener.java b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityNodeCheckStateListener.java
index ec7d01d..b208abc 100644
--- a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityNodeCheckStateListener.java
+++ b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityNodeCheckStateListener.java
@@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.ocl.examples.emf.validation.validity.AbstractNode;
import org.eclipse.ocl.examples.emf.validation.validity.ConstrainingNode;
+import org.eclipse.ocl.examples.emf.validation.validity.ResultConstrainingNode;
import org.eclipse.ocl.examples.emf.validation.validity.ResultValidatableNode;
import org.eclipse.ocl.examples.emf.validation.validity.RootConstrainingNode;
import org.eclipse.ocl.examples.emf.validation.validity.RootValidatableNode;
@@ -47,7 +48,7 @@ public class ValidityNodeCheckStateListener implements ICheckStateListener {
// update Selected Element check
abstractNode.setEnabled(checked);
- //update Selected Element Results children check;
+ // update Selected Element Results children check
updateChildrenNodesState(abstractNode, checked);
// update Selected Element parents checks/grayed
@@ -60,6 +61,9 @@ public class ValidityNodeCheckStateListener implements ICheckStateListener {
ValidatableNode validatableNode = (ValidatableNode) abstractNode;
updateValidatableNodeAncestors(validatableNode, checked);
}
+
+ // update corresponding element in the adjacent tree
+ propagateToAdjacentTree(abstractNode, checked);
} else {
// DO NOTHING
}
@@ -244,6 +248,33 @@ public class ValidityNodeCheckStateListener implements ICheckStateListener {
constraintsTree.setChecked(child, checked);
updateChildrenNodesState(child, checked);
}
+
+ propagateToAdjacentTree(child, checked);
+ }
+ }
+
+ /**
+ * Propagates results selection to the adjacent tree. The propagation is ascendant since the
+ * ResultValidatableNode and ResultConstrainingNode have no children to update.
+ */
+ private void propagateToAdjacentTree(AbstractNode abstractNode,
+ boolean checked) {
+ if (abstractNode instanceof ResultValidatableNode) {
+ ResultConstrainingNode resultConstrainingNode = ((ResultValidatableNode) abstractNode)
+ .getResultConstrainingNode();
+ resultConstrainingNode.setEnabled(checked);
+ constraintsTree.setChecked(resultConstrainingNode, checked);
+
+ // update Element parents checks/grayed
+ updateConstrainingNodeAncestors(resultConstrainingNode, checked);
+ } else if (abstractNode instanceof ResultConstrainingNode) {
+ ResultValidatableNode resultValidatableNode = ((ResultConstrainingNode) abstractNode)
+ .getResultValidatableNode();
+ resultValidatableNode.setEnabled(checked);
+ validatableTree.setChecked(resultValidatableNode, checked);
+
+ // update Element parents checks/grayed
+ updateValidatableNodeAncestors(resultValidatableNode, checked);
}
}
}