*******************************************************************************/
package org.simantics.modeling;
-import gnu.trove.set.hash.THashSet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.NamedResource;
-import org.simantics.db.common.request.ObjectsWithType;
import org.simantics.db.common.request.PossibleIndexRoot;
import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.common.utils.VersionMap;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.adapter.Instances;
import org.simantics.db.layer0.request.ActiveModels;
+import org.simantics.db.layer0.request.ListIndexRoots;
import org.simantics.db.layer0.util.Layer0Utils;
import org.simantics.diagram.stubs.DiagramResource;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.MigrateModel.MigrationOperation;
import org.simantics.modeling.migration.UserComponentPostMigrationAction;
-import org.simantics.simulation.ontology.SimulationResource;
import org.simantics.structural.stubs.StructuralResource2;
import org.simantics.utils.datastructures.MapList;
import org.simantics.utils.datastructures.Pair;
import org.simantics.utils.datastructures.Triple;
import org.simantics.utils.strings.AlphanumComparator;
+import gnu.trove.set.hash.THashSet;
+
/**
* @author Antti Villberg
* @author Tuukka Lehtonen
}
private static Collection<NamedResource> getLocations(ReadGraph graph, final Resource project) throws DatabaseException {
- Layer0 L0 = Layer0.getInstance(graph);
- SimulationResource SIMU = SimulationResource.getInstance(graph);
Collection<NamedResource> libraries = new ArrayList<>();
- for (Resource r : graph.syncRequest(new ObjectsWithType(project, L0.ConsistsOf, SIMU.Model))) {
- String name = Versions.getStandardNameString(graph, r);
- libraries.add(new NamedResource(name, r));
- }
- Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "traverseSharedOntologies", graph, graph.getRootLibrary());
- for (Resource r : ontologies) {
+ for (Resource r : graph.syncRequest(new ListIndexRoots())) {
String name = Versions.getStandardNameString(graph, r);
libraries.add(new NamedResource(name, r));
}
+// Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "traverseSharedOntologies", graph, graph.getRootLibrary());
+// for (Resource r : ontologies) {
+// String name = Versions.getStandardNameString(graph, r);
+// libraries.add(new NamedResource(name, r));
+// }
return libraries;
}