From 49db73ca771bcad373e2659d40553ce51bc7d9fb Mon Sep 17 00:00:00 2001 From: Johannes Eder <eder@fortiss.org> Date: Mon, 9 Dec 2019 17:24:59 +0100 Subject: [PATCH] ignoring anytype elements * problem with refernces to anytype elements persists Issue-Ref: 3865 Issue-Url: https://af3-developer.fortiss.org/issues/3865 Signed-off-by: Johannes Eder <eder@fortiss.org> --- .../fortiss/tooling/kernel/internal/MigrationService.java | 6 +----- .../tooling/kernel/internal/storage/eclipse/.ratings | 2 +- .../kernel/internal/storage/eclipse/ModelContext.java | 4 +++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java index b0f05859e..9786e3974 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java @@ -28,7 +28,6 @@ import java.util.Map.Entry; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.xml.type.AnyType; import org.fortiss.tooling.kernel.ToolingKernelActivator; @@ -138,10 +137,7 @@ public class MigrationService extends ObjectAwareServiceBase<IMigrationProvider> error(ToolingKernelActivator.getDefault(), input.getSaveableName() + " contains one or more unknown feature(s) which will be deleted: " + featuresToStrings(unknownFeatures)); - - for(Entry<EObject, AnyType> e : unknownFeatures.entrySet()) { - EcoreUtil.delete(e.getKey(), true); - } + unknownFeatures.clear(); } } }); diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings index 4a4edee0b..129d11bd3 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings @@ -1,5 +1,5 @@ AutoUndoCommandStack.java fc326adf66c6cea2354884cdc240da5f2f82689a GREEN EMFTransactionalCommand.java ba4b5bead9768b6ce6c955b9238cd96cb722533c GREEN EclipseResourceStorageService.java e29e32272286921c5e43963253902b3ba54490c7 GREEN -ModelContext.java 55de5f19c5d625f935fb8136ff72d80b3a54ff19 GREEN +ModelContext.java db1735834c85e7b508266f56463d011f2b72af0e YELLOW NonDirtyingEMFTransactionalCommand.java d288ebe35d22442c603496b0c917fb99a8febeea GREEN diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java index 55de5f19c..db1735834 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java @@ -330,7 +330,9 @@ class ModelContext implements ITopLevelElement, CommandStackListener { // Step 3..n: Save resources not managed by kernel for(Resource currentResource : rset.getResources()) { - if(currentResource != resource && !editingDomain.isReadOnly(currentResource)) { + if(currentResource != resource && !editingDomain.isReadOnly(currentResource) && + !currentResource.getContents().isEmpty()) { + // do not save resources which are not contained (by a FileProject) try { currentResource.save(saveOptions); } catch(IOException e) { -- GitLab