]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ProfileEntryChildren.java
Better support for ontological profiles
[simantics/platform.git] / bundles / org.simantics.diagram.profile / src / org / simantics / diagram / profile / view / ProfileEntryChildren.java
index d16a776c7c1e24826fb59ff26e4d3c334ab65f14..712bd50fb6f3fa8ce0ce72265328f06e07e90ac5 100644 (file)
@@ -18,7 +18,6 @@ import java.util.Collections;
 import org.simantics.browsing.ui.model.children.ChildRule;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
-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;
@@ -27,28 +26,28 @@ public class ProfileEntryChildren implements ChildRule {
 
        @Override
        public boolean isCompatible(Class<?> contentType) {
-               return contentType.equals(ResourcePair.class);
+               return contentType.equals(ProfileTuple.class);
        }
 
        @Override
        public Collection<?> getChildren(ReadGraph graph, Object parent)
                        throws DatabaseException {
-
-               ResourcePair entry = (ResourcePair)parent;
-       ArrayList<ResourcePair> entries = new ArrayList<ResourcePair>();
-       DiagramResource DIA = DiagramResource.getInstance(graph);
-       Resource children = graph.getPossibleObject(entry.getSecond(), DIA.HasEntries);
-       if(children == null) return Collections.emptyList();
-       else {
-               for(Resource entry2 : ProfileUtils.getProfileChildrenFromEntries(graph, children)) entries.add(new ResourcePair(entry.getFirst(), entry2));
-               return entries;
-       }
-    }
+               ProfileTuple entry = (ProfileTuple) parent;
+               ArrayList<ProfileTuple> entries = new ArrayList<>();
+               DiagramResource DIA = DiagramResource.getInstance(graph);
+               Resource children = graph.getPossibleObject(entry.getEntry(), DIA.HasEntries);
+               if (children != null) {
+                       for (Resource entry2 : ProfileUtils.getProfileChildrenFromEntries(graph, children))
+                               entries.add(new ProfileTuple(entry.getBaseProfile(), entry2, entry.getRuntimeDiagram()));
+                       return entries;
+               }
+               return Collections.emptyList();
+       }
 
        @Override
        public Collection<?> getParents(ReadGraph graph, Object child)
                        throws DatabaseException {
-               return new ArrayList<Resource>();
+               return Collections.emptyList();
        }
 
 }