X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Fscl%2Fimports%2FSCLModulesQuery.java;h=473947e29be41f0b9132bcbbc42dae6f3a468b38;hb=28438fa467ae60dd63515be2df724c6ff9c299c9;hp=a1d20de72b209895d1c3b7783cc19e113d2c2452;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesQuery.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesQuery.java index a1d20de72..473947e29 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesQuery.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesQuery.java @@ -1,39 +1,39 @@ -package org.simantics.modeling.ui.scl.imports; - -import java.util.ArrayList; -import java.util.Collection; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.UnaryRead; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; - -public class SCLModulesQuery extends UnaryRead> { - - public SCLModulesQuery(Resource parameter) { - super(parameter); - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - ArrayList result = new ArrayList(); - - Layer0 L0 = Layer0.getInstance(graph); - browse(graph, L0, parameter, result); - - return result; - } - - private static void browse(ReadGraph graph, Layer0 L0, Resource current, - ArrayList result) throws DatabaseException { - if(graph.isInstanceOf(current, L0.SCLModule)) - result.add(graph.getURI(current)); - else if(graph.isInstanceOf(current, L0.Library) - || graph.isInstanceOf(current, L0.IndexRoot)) { - for(Resource child : graph.getObjects(current, L0.ConsistsOf)) - browse(graph, L0, child, result); - } - } - -} +package org.simantics.modeling.ui.scl.imports; + +import java.util.ArrayList; +import java.util.Collection; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.UnaryRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; + +public class SCLModulesQuery extends UnaryRead> { + + public SCLModulesQuery(Resource parameter) { + super(parameter); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + ArrayList result = new ArrayList(); + + Layer0 L0 = Layer0.getInstance(graph); + browse(graph, L0, parameter, result); + + return result; + } + + private static void browse(ReadGraph graph, Layer0 L0, Resource current, + ArrayList result) throws DatabaseException { + if(graph.isInstanceOf(current, L0.SCLModule)) + result.add(graph.getURI(current)); + else if(graph.isInstanceOf(current, L0.Library) + || graph.isInstanceOf(current, L0.IndexRoot)) { + for(Resource child : graph.getObjects(current, L0.ConsistsOf)) + browse(graph, L0, child, result); + } + } + +}