1 package org.simantics.issues.ui;
3 import java.util.Collection;
4 import java.util.Collections;
6 import org.simantics.browsing.ui.model.children.ChildRule;
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.variable.Variable;
12 * @author Tuukka Lehtonen
15 public class DynamicIssueSourceHierarchyRule implements ChildRule {
18 public boolean isCompatible(Class<?> contentType) {
19 return contentType.equals(Variable.class);
23 public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {
24 Variable v = (Variable) parent;
25 return v.getChildren(graph);
29 public Collection<?> getParents(ReadGraph graph, Object child) throws DatabaseException {
30 Variable parent = ((Variable)child).getParent(graph);
31 return parent != null ? Collections.singleton(parent) : Collections.emptyList();