X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.processeditor%2Fsrc%2Forg%2Fsimantics%2Fprocesseditor%2Fmonitors%2FPathContainer.java;fp=org.simantics.processeditor%2Fsrc%2Forg%2Fsimantics%2Fprocesseditor%2Fmonitors%2FPathContainer.java;h=0000000000000000000000000000000000000000;hb=6b6fcff5d6c326feef07ccf8401f97911778fffe;hp=7a7998047abfa174b456a2e757df827b4f74b6b7;hpb=504c111db40d78f4913badddd126b283b5504dbb;p=simantics%2F3d.git diff --git a/org.simantics.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java b/org.simantics.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java deleted file mode 100644 index 7a799804..00000000 --- a/org.simantics.processeditor/src/org/simantics/processeditor/monitors/PathContainer.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007- VTT Technical Research Centre of Finland. - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.processeditor.monitors; - -import java.util.Collection; -import java.util.List; - -import org.simantics.db.Resource; -import org.simantics.layer0.utils.IEntity; -import org.simantics.utils.datastructures.MapList; - - -/** - * Container for Paths - * FIXME : singleton - * TODO : removing paths - * TODO : prevent adding same path multiple times - * TODO : how to handle multi-instances? - * - * - * @author Marko Luukkainen - * - */ -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) { - // 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) { - paths.add(type, path); - } - - public void clearPaths(Resource type) { - paths.remove(type); - } - - public static PathContainer getInstance() { - return instance; - } - -}