X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Fviewpoint%2FVariableChildRule.java;h=df2f8447774fec839fd823ba4ae1a6c7c22d0545;hb=95144e3b879f0a10715927027bb9a7aa8e05bdeb;hp=bfd5a85be133dbd3ff32372deaccfac9458519e3;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/viewpoint/VariableChildRule.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/viewpoint/VariableChildRule.java index bfd5a85be..df2f84477 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/viewpoint/VariableChildRule.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/viewpoint/VariableChildRule.java @@ -1,37 +1,37 @@ -package org.simantics.modeling.ui.viewpoint; - -import java.util.Collection; -import java.util.Collections; - -import org.simantics.browsing.ui.model.children.ChildRule; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.structural.stubs.StructuralResource2; - -public class VariableChildRule implements ChildRule { - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(Variable.class); - } - - @Override - public Collection getChildren(ReadGraph graph, Object parent) - throws DatabaseException { - Collection children = ((Variable)parent).getChildren(graph); - return VariableChildren.filterByClassification(graph, children, StructuralResource2.URIs.Component); - } - - @Override - public Collection getParents(ReadGraph graph, Object child) - throws DatabaseException { - Variable parent = ((Variable)child).getParent(graph); - if(parent == null) - return Collections.emptyList(); - else - return Collections.singleton(parent); - } - - -} +package org.simantics.modeling.ui.viewpoint; + +import java.util.Collection; +import java.util.Collections; + +import org.simantics.browsing.ui.model.children.ChildRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.structural.stubs.StructuralResource2; + +public class VariableChildRule implements ChildRule { + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Variable.class); + } + + @Override + public Collection getChildren(ReadGraph graph, Object parent) + throws DatabaseException { + Collection children = ((Variable)parent).getChildren(graph); + return VariableChildren.filterByClassification(graph, children, StructuralResource2.URIs.Component); + } + + @Override + public Collection getParents(ReadGraph graph, Object child) + throws DatabaseException { + Variable parent = ((Variable)child).getParent(graph); + if(parent == null) + return Collections.emptyList(); + else + return Collections.singleton(parent); + } + + +}