From: luukkainen Date: Thu, 22 Jan 2009 16:12:03 +0000 (+0000) Subject: git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8819 ac1ea38d... X-Git-Tag: simantics-1.19.0~20^2~5 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=b3c3be84d629d56b355fc6bb8cee8ae16990d783;p=simantics%2F3d.git git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8819 ac1ea38d-2e2b-0410-8846-a27921b304fc --- 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) {