Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2017-05-16 10:05:45 +0000
committerStéphane Bégaudeau2017-05-16 10:05:45 +0000
commit5b6a3bd3be7e31958eb72cd49c3f281c5f0e4f53 (patch)
tree04ca3c30fbc8331fb95bb62cd038aa36ade23c49
parent0f1b216f4a08bc964c7241ab53d1324b15f2b147 (diff)
downloadorg.eclipse.eef-5b6a3bd3be7e31958eb72cd49c3f281c5f0e4f53.tar.gz
org.eclipse.eef-5b6a3bd3be7e31958eb72cd49c3f281c5f0e4f53.tar.xz
org.eclipse.eef-5b6a3bd3be7e31958eb72cd49c3f281c5f0e4f53.zip
[515586] Handle dynamic mappings recursively for the force refresh
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=515586 Change-Id: Ie02fd19ac68e5253061661856c82589612df84f6 Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.ide.ui.properties/src/org/eclipse/eef/ide/ui/properties/api/EEFTabDescriptor.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/org.eclipse.eef.ide.ui.properties/src/org/eclipse/eef/ide/ui/properties/api/EEFTabDescriptor.java b/plugins/org.eclipse.eef.ide.ui.properties/src/org/eclipse/eef/ide/ui/properties/api/EEFTabDescriptor.java
index b8e7dff3a..0b0ffce47 100644
--- a/plugins/org.eclipse.eef.ide.ui.properties/src/org/eclipse/eef/ide/ui/properties/api/EEFTabDescriptor.java
+++ b/plugins/org.eclipse.eef.ide.ui.properties/src/org/eclipse/eef/ide/ui/properties/api/EEFTabDescriptor.java
@@ -12,7 +12,10 @@ package org.eclipse.eef.ide.ui.properties.api;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
+import org.eclipse.eef.EEFContainerDescription;
+import org.eclipse.eef.EEFControlDescription;
import org.eclipse.eef.EEFDynamicMappingFor;
import org.eclipse.eef.EefPackage;
import org.eclipse.eef.core.api.EEFExpressionUtils;
@@ -80,9 +83,7 @@ public class EEFTabDescriptor extends AbstractEEFTabDescriptor {
// @formatter:off
groups.stream().map(EEFGroup::getDescription)
- .flatMap(description -> description.getControls().stream())
- .filter(EEFDynamicMappingFor.class::isInstance)
- .map(EEFDynamicMappingFor.class::cast)
+ .flatMap(description -> description.getControls().stream().flatMap(this::getDynamicMappingFors))
.filter(EEFDynamicMappingFor::isForceRefresh)
.findFirst()
.ifPresent(control -> identifier.append(System.currentTimeMillis()));
@@ -97,9 +98,29 @@ public class EEFTabDescriptor extends AbstractEEFTabDescriptor {
}
/**
+ * Returns recursively a stream of the dynamic mappings for the given control.
+ *
+ * @param eefControlDescription
+ * The description of the control
+ * @return The stream of the dynamic mapping
+ */
+ private Stream<EEFDynamicMappingFor> getDynamicMappingFors(EEFControlDescription eefControlDescription) {
+ Stream<EEFDynamicMappingFor> stream = Stream.empty();
+
+ if (eefControlDescription instanceof EEFDynamicMappingFor) {
+ stream = Stream.of((EEFDynamicMappingFor) eefControlDescription);
+ } else if (eefControlDescription instanceof EEFContainerDescription) {
+ EEFContainerDescription eefContainerDescription = (EEFContainerDescription) eefControlDescription;
+ stream = eefContainerDescription.getControls().stream().flatMap(this::getDynamicMappingFors);
+ }
+
+ return stream;
+ }
+
+ /**
* Returns an unique identifier for the given EObject which will stay the same even after changes which would impact
* its URI (for example, changing the name of an EClass).
- *
+ *
* @param eObject
* The EObject
* @return The unique identifier of the given EObject

Back to the top