X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.issues.common%2Fsrc%2Forg%2Fsimantics%2Fissues%2Fcommon%2FAll.java;h=d39ee983745bed698ffa35c49342d3228999252b;hp=6eccb1755f22c746f9f91666e57b097a543467a8;hb=a770d29c1cd08ec09aed5a988cb54c9aaf623f3f;hpb=287c8e8582649f0efa17705f7b358cfe75c40511 diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/All.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/All.java index 6eccb1755..d39ee9837 100644 --- a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/All.java +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/All.java @@ -14,6 +14,7 @@ import org.simantics.db.layer0.variable.Variables; import org.simantics.issues.ontology.IssueResource; import org.simantics.layer0.Layer0; import org.simantics.scl.reflection.annotations.SCLValue; +import org.simantics.scl.runtime.function.Function1; public class All { @@ -96,4 +97,30 @@ public class All { throw new IllegalArgumentException("Unsupported property type: " + property); } + @SCLValue(type = "ReadGraph -> Resource -> a -> b") + public static Function1 standardIssueHider(ReadGraph graph, Resource converter, Object property) throws DatabaseException { + if (property instanceof Variable) { + Variable hider = (Variable) property; + Variable issue = hider.getParent(graph); + Resource r = issue.getPossibleRepresents(graph); + if (r != null) + return new HideFunction(r); + } + return null; + } + + @SCLValue(type = "ReadGraph -> Resource -> a -> Boolean") + public static Boolean standardIssueHidden(ReadGraph graph, Resource converter, Object property) throws DatabaseException { + if (property instanceof Variable) { + Variable hidden = (Variable) property; + Variable issue = hidden.getParent(graph); + Resource r = issue.getPossibleRepresents(graph); + if (r != null) { + IssueResource ISSUE = IssueResource.getInstance(graph); + return graph.hasStatement(r, ISSUE.Hidden); + } + } + return false; + } + }