package org.simantics.interop.browsing; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import org.simantics.browsing.ui.model.children.ChildRule; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; public class InteropChildRule implements ChildRule{ @Override public boolean isCompatible(Class contentType) { return Resource.class.isAssignableFrom(contentType); } @Override public Collection getChildren(ReadGraph graph, Object parent_) throws DatabaseException { Resource parent = (Resource)parent_; List nodes = new ArrayList(); nodes.add(new ImportNode2(parent)); return nodes; } @Override public Collection getParents(ReadGraph graph, Object child) throws DatabaseException { return Collections.emptyList(); // It is not necessary to support this } }