Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-05-22 08:40:46 -0400
committerPierre-Charles David2017-05-23 03:16:29 -0400
commit65d3718858c7d96db7d11632225777a90e766e70 (patch)
treec38bd9f26b18cdd6e22854457a7fb748a9301d83
parent18cbce9d34d898fbed141209950f0cc06ddffb7b (diff)
downloadorg.eclipse.sirius-65d3718858c7d96db7d11632225777a90e766e70.tar.gz
org.eclipse.sirius-65d3718858c7d96db7d11632225777a90e766e70.tar.xz
org.eclipse.sirius-65d3718858c7d96db7d11632225777a90e766e70.zip
[517060] Fix regression in XtextSavingPolicyv5.0.0rc1
Commit b57cf3a40deb5d33 was made a little too fast and caused a regression. Use simpler and more transparent code to filter out TypeResources. Bug: 517060 Change-Id: I947e00c7605e91c00e31a56b0aa6b6aa57647b9e Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal/XtextSavingPolicy.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal/XtextSavingPolicy.java b/plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal/XtextSavingPolicy.java
index a36c4c8922..8ab90c7b96 100644
--- a/plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal/XtextSavingPolicy.java
+++ b/plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal/XtextSavingPolicy.java
@@ -10,9 +10,11 @@
*******************************************************************************/
package org.eclipse.sirius.common.xtext.internal;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.function.Predicate;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
@@ -56,8 +58,14 @@ public class XtextSavingPolicy implements SavingPolicy {
newOptions.putAll(options);
}
newOptions.putAll(SaveOptions.newBuilder().noValidation().getOptions().toOptionsMap());
- Stream<Resource> writeableResourcesToSave = StreamSupport.stream(resourcesToSave.spliterator(), false).filter(k -> ! (k instanceof TypeResource));
- return delegate.save(() -> writeableResourcesToSave.iterator(), newOptions, monitor);
+
+ Collection<Resource> writeableResourcesToSave = new ArrayList<>();
+ resourcesToSave.forEach(r -> {
+ if (!(r instanceof TypeResource)) {
+ writeableResourcesToSave.add(r);
+ }
+ });
+ return delegate.save(writeableResourcesToSave, newOptions, monitor);
}
}

Back to the top