From: Antti Villberg Date: Sun, 7 May 2017 06:52:03 +0000 (+0300) Subject: Use ListIndexRoots in migration X-Git-Tag: v1.29.0~70^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F494%2F1;p=simantics%2Fplatform.git Use ListIndexRoots in migration refs #7198 Change-Id: I09c034e1723ec8bc35706d137f5a8c8cba96a44a --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/UserComponentMigration.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/UserComponentMigration.java index b4db9c876..be480be47 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/UserComponentMigration.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/UserComponentMigration.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.simantics.modeling; -import gnu.trove.set.hash.THashSet; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -28,7 +26,6 @@ import org.simantics.db.ReadGraph; 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; @@ -37,18 +34,20 @@ import org.simantics.db.exception.CancelTransactionException; 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 @@ -239,18 +238,16 @@ public class UserComponentMigration { } private static Collection getLocations(ReadGraph graph, final Resource project) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - SimulationResource SIMU = SimulationResource.getInstance(graph); Collection 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 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 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; }