diff options
| author | Florian Barbin | 2017-06-01 15:01:03 +0000 |
|---|---|---|
| committer | Laurent Fasani | 2017-07-07 15:55:54 +0000 |
| commit | 9170ebe72a21487bb0304518ee773058fcaf64c7 (patch) | |
| tree | d3f7a292ed7c3d0c70d486edac0549c3adf94b1d | |
| parent | 9ae2852bc4c4dd63d3cb2e5f608930399f515e65 (diff) | |
| download | org.eclipse.sirius-9170ebe72a21487bb0304518ee773058fcaf64c7.tar.gz org.eclipse.sirius-9170ebe72a21487bb0304518ee773058fcaf64c7.tar.xz org.eclipse.sirius-9170ebe72a21487bb0304518ee773058fcaf64c7.zip | |
[516669] Fixes RemoveSemanticResourceAction
* Use the DRepresentationDescriptor to look for representations
referencing the semantic resource to delete.
Bug: 516669
Change-Id: Ia4512aa688fa6bbd92473ff6fa7781a215a226f8
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java index e9cfa1f0d2..fb95f8ffb2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2017 THALES GLOBAL SERVICES and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.action.Action; @@ -36,7 +37,7 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.resource.AirdResource; import org.eclipse.sirius.tools.api.command.semantic.RemoveSemanticResourceCommand; import org.eclipse.sirius.viewpoint.DAnalysisSessionEObject; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; @@ -193,8 +194,8 @@ public class RemoveSemanticResourceAction extends Action { */ private Map<ErrorKind, Set<Resource>> checkAllResourcesAreRemovable() { Map<ErrorKind, Set<Resource>> errorKindToResource = new HashMap<>(); - Set<Resource> dSemanticDecoratorsEResources = DialectManager.INSTANCE.getAllRepresentations(session).stream().filter(rep -> rep instanceof DSemanticDecorator) - .map(rep -> ((DSemanticDecorator) rep).getTarget() == null ? null : ((DSemanticDecorator) rep).getTarget().eResource()).collect(Collectors.toSet()); + Set<Resource> repDescriptorEResources = DialectManager.INSTANCE.getAllRepresentationDescriptors(session).stream().map(DRepresentationDescriptor::getTarget).map(EObject::eResource) + .collect(Collectors.toSet()); for (Resource semanticResourceToRemove : toRemove) { IFile airdFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(session.getSessionResource().getURI().toPlatformString(true))); @@ -219,7 +220,7 @@ public class RemoveSemanticResourceAction extends Action { } controlledResources.add(semanticResourceToRemove); } - if (!(semanticResourceToRemove instanceof AirdResource) && dSemanticDecoratorsEResources.contains(semanticResourceToRemove)) { + if (!(semanticResourceToRemove instanceof AirdResource) && repDescriptorEResources.contains(semanticResourceToRemove)) { Set<Resource> resourcesWithActiveRepresentations = errorKindToResource.get(ErrorKind.ACTIVE_REPRESENTATION); if (resourcesWithActiveRepresentations == null) { resourcesWithActiveRepresentations = new HashSet<>(); |
