Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Guilet2018-10-10 16:56:54 +0000
committerMaxime Porhel2018-10-11 13:27:09 +0000
commitaae93420a53352b578ed63d2544b0d6a091198bd (patch)
tree4a0c720138ecf7dc6dc8e744dcbcb02a4aa8e56c
parent9dd89d7bb5fa5acc51722c8c6ebf0156e9506e9f (diff)
downloadorg.eclipse.sirius-aae93420a53352b578ed63d2544b0d6a091198bd.tar.gz
org.eclipse.sirius-aae93420a53352b578ed63d2544b0d6a091198bd.tar.xz
org.eclipse.sirius-aae93420a53352b578ed63d2544b0d6a091198bd.zip
[527109] Fix visibility mode layer activation
Fix layer not activated from automatic migration because of the ChangeLayerCommand used two times instead of one. Bug:527109 Change-Id: Ic51ecf8ec39d5875dcf4231ee95d24256e602923 Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DoubleClickEditPolicy.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DoubleClickEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DoubleClickEditPolicy.java
index e22dbaf5b4..9925e293c9 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DoubleClickEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DoubleClickEditPolicy.java
@@ -14,9 +14,9 @@ package org.eclipse.sirius.diagram.ui.graphical.edit.policies;
import java.text.MessageFormat;
import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Optional;
@@ -250,7 +250,7 @@ public class DoubleClickEditPolicy extends OpenEditPolicy {
private Entry<String, org.eclipse.emf.common.command.Command> getCommandToActivateLayerShowingElementAndPArents(DDiagram parentDiagram, final Set<DDiagramElement> elementSet) {
CompoundCommand layerCompoundCommand = new CompoundCommand();
Optional<Session> optionalSession = Session.of(parentDiagram);
- List<String> layersToActivateList = new ArrayList<>();
+ Set<String> layersToActivateSet = new LinkedHashSet<>();
if (optionalSession.isPresent()) {
DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(optionalSession.get(), parentDiagram);
for (DDiagramElement dDiagramElement : elementSet) {
@@ -258,14 +258,16 @@ public class DoubleClickEditPolicy extends OpenEditPolicy {
Layer layerToActivate = getLayerToActivate(parentDiagram, dDiagramElement, mappingManager);
if (layerToActivate != null) {
final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(parentDiagram);
- layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor()));
- layersToActivateList.add(layerToActivate.getName());
+ if (!layersToActivateSet.contains(layerToActivate.getName())) {
+ layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor()));
+ layersToActivateSet.add(layerToActivate.getName());
+ }
}
}
}
}
return layerCompoundCommand.getCommandList().size() > 0
- ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivateList.stream().collect(Collectors.joining(", ")), layerCompoundCommand) //$NON-NLS-1$
+ ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivateSet.stream().collect(Collectors.joining(", ")), layerCompoundCommand) //$NON-NLS-1$
: null;
}

Back to the top