From b3c3be84d629d56b355fc6bb8cee8ae16990d783 Mon Sep 17 00:00:00 2001 From: luukkainen Date: Thu, 22 Jan 2009 16:12:03 +0000 Subject: [PATCH] git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8819 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../processeditor/monitors/PathContainer.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/org.simantics.proconf.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java b/org.simantics.proconf.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java index b0205f52..f41b4b1f 100644 --- a/org.simantics.proconf.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java +++ b/org.simantics.proconf.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java @@ -23,6 +23,7 @@ import org.simantics.utils.datastructures.MapList; * FIXME : singleton * TODO : removing paths * TODO : prevent adding same path multiple times + * TODO : how to handle multi-instances? * * * @author Marko Luukkainen @@ -33,17 +34,29 @@ public class PathContainer { private static PathContainer instance = new PathContainer(); MapList> paths; + //List,List>> multiInstancePaths; private PathContainer() { paths = new MapList>(); + //multiInstancePaths = new ArrayList,List>>(); } public List> getPaths(IEntity instance) { Collection types = instance.getTypes(); - if (types.size() != 1) - throw new UnsupportedOperationException("Multi-instances not supported!"); - Resource type = types.iterator().next().getResource(); - return paths.getValues(type); + if (types.size() != 1) { + // for multi-instances we check if any of the types have paths + // no we return paths for a single type (it is possible to combine paths for all types) + for (IEntity type : types) { + Resource r = type.getResource(); + List> path = paths.getValues(r); + if (path != null) + return path; + } + return null; + } else { + Resource type = types.iterator().next().getResource(); + return paths.getValues(type); + } } public void addPath(Resource type, List path) { -- 2.45.2