X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.profile%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fprofile%2Frequest%2FReferencedProfileEntries.java;h=edc46b6222aa37431a6596e24b40bad9bd834064;hb=refs%2Fchanges%2F88%2F1688%2F1;hp=53610658ba2e1a7cbc00a0b015192d2e14db7578;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/request/ReferencedProfileEntries.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/request/ReferencedProfileEntries.java index 53610658b..edc46b622 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/request/ReferencedProfileEntries.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/request/ReferencedProfileEntries.java @@ -1,45 +1,44 @@ -package org.simantics.diagram.profile.request; - -import java.util.Collection; -import java.util.HashSet; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.ResourceRead; -import org.simantics.db.common.utils.ListUtils; -import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.stubs.DiagramResource; -import org.simantics.scenegraph.profile.ProfileUtils; - -public class ReferencedProfileEntries extends ResourceRead> { - - public ReferencedProfileEntries(Resource part) { - super(part); - } - - public HashSet process(ReadGraph graph, Resource resource, HashSet result) throws DatabaseException { - - DiagramResource DIA = DiagramResource.getInstance(graph); - - if(graph.isInstanceOf(resource, DIA.Profile)) { - - for(Resource child : ProfileUtils.getProfileChildren(graph, resource)) { - process(graph, child, result); - } - - } else if(graph.isInstanceOf(resource, DIA.ProfileEntry)) { - - result.add(resource); - - } - - return result; - - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - return process(graph, resource, new HashSet()); - } - -} +package org.simantics.diagram.profile.request; + +import java.util.Collection; +import java.util.HashSet; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.scenegraph.profile.ProfileUtils; + +public class ReferencedProfileEntries extends ResourceRead> { + + public ReferencedProfileEntries(Resource part) { + super(part); + } + + public HashSet process(ReadGraph graph, Resource resource, HashSet result) throws DatabaseException { + + DiagramResource DIA = DiagramResource.getInstance(graph); + + if(graph.isInstanceOf(resource, DIA.Profile)) { + + for(Resource child : ProfileUtils.getProfileChildren(graph, resource)) { + process(graph, child, result); + } + + } else if(graph.isInstanceOf(resource, DIA.ProfileEntry)) { + + result.add(resource); + + } + + return result; + + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + return process(graph, resource, new HashSet()); + } + +}