From: jsimomaa Date: Fri, 7 Dec 2018 06:51:47 +0000 (+0200) Subject: Change mapping of elements, not the mapping itself X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=a0809b57d402e300f8b5001527e99c89f974bddb;p=simantics%2Fdistrict.git Change mapping of elements, not the mapping itself gitlab #22 Change-Id: I93210fdb5c66469c5eb40451435745f23528313f --- diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java index 2b3d1888..1f948335 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java @@ -245,18 +245,25 @@ public class ChangeMappingTypeHandler { @Override protected void computeResult() { + Map> currentElements = null; + try { + currentElements = elements.get(); + } catch (InterruptedException | ExecutionException e) { + LOGGER.error("Could not get currentElements", e); + throw new RuntimeException("Could not get currentElements", e); + } for (Map.Entry combos : mappingCombos.entrySet()) { NamedResource resource = combos.getKey(); Combo c = combos.getValue(); String item = c.getItem(c.getSelectionIndex()); - + Collection collection = currentElements.get(resource); Map map = possibleMappings.get(resource); Resource newMapping = map.get(item); results.compute(newMapping, (t, u) -> { if (u == null) { u = new HashSet<>(); } - u.add(resource); + u.addAll(collection); return u; }); }