From: villberg Date: Fri, 2 Dec 2011 08:35:53 +0000 (+0000) Subject: Lots of changes X-Git-Tag: simantics-1.6~80 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=2f554b96e58889bbc8d72699b2ac95bd45b1c05e;p=simantics%2Fsysdyn.git Lots of changes git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@23387 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index db04ecd4..fb9fff65 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -39,7 +39,7 @@ import org.simantics.db.request.Read; import org.simantics.db.service.GraphChangeListenerSupport; import org.simantics.db.service.LifecycleSupport; import org.simantics.db.service.VirtualGraphSupport; -import org.simantics.issues.common.IssueUtil; +import org.simantics.issues.common.IssueUtils; import org.simantics.layer0.Layer0; import org.simantics.modeling.services.CaseInsensitiveComponentNamingStrategy2; import org.simantics.modeling.services.ComponentNamingStrategy; @@ -295,7 +295,7 @@ public class SysdynProject extends AbstractProjectFeature { }); - IssueUtil.listenActiveProjectIssueSources(graph, project.get()); + IssueUtils.listenActiveProjectIssueSources(graph, project.get()); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java index 8a550544..dbad2a45 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java @@ -19,13 +19,12 @@ import java.util.Set; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.utils.ListUtils; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.issues.common.Issue; +import org.simantics.issues.common.IssueUtils; import org.simantics.issues.common.StandardIssue; -import org.simantics.issues.ontology.IssueResource; import org.simantics.layer0.Layer0; import org.simantics.scl.reflection.annotations.SCLValue; import org.simantics.sysdyn.SysdynResource; @@ -153,12 +152,10 @@ public class DependencyFunction { * @throws DatabaseException */ @SCLValue(type = "ReadGraph -> Resource -> Variable -> String") - public static String missingLinkIssueDescription(ReadGraph graph, Resource converter, Variable issue) + public static String missingLinkIssueDescription(ReadGraph graph, Resource converter, Variable property) throws DatabaseException { - IssueResource ISSUE = IssueResource.getInstance(graph); - Resource issueResource = issue.getRepresents(graph); - Resource list = graph.getSingleObject(issueResource, ISSUE.Sources_DependencyTracker_Issue_HasContexts); - List contexts = ListUtils.toList(graph, list); + + List contexts = IssueUtils.getContextsForProperty(graph, property); String result = "Missing a link to "; if (contexts.size() > 0) { Resource component = contexts.get(1); @@ -166,6 +163,7 @@ public class DependencyFunction { result = result + name; } return result; + } /** @@ -178,12 +176,10 @@ public class DependencyFunction { * @throws DatabaseException */ @SCLValue(type = "ReadGraph -> Resource -> Variable -> String") - public static String unusedDependencyIssueDescription(ReadGraph graph, Resource converter, Variable issue) + public static String unusedDependencyIssueDescription(ReadGraph graph, Resource converter, Variable property) throws DatabaseException { - IssueResource ISSUE = IssueResource.getInstance(graph); - Resource issueResource = issue.getRepresents(graph); - Resource list = graph.getSingleObject(issueResource, ISSUE.Sources_DependencyTracker_Issue_HasContexts); - List contexts = ListUtils.toList(graph, list); + + List contexts = IssueUtils.getContextsForProperty(graph, property); String result = "Unused dependency: "; if (contexts.size() > 0) { Resource component = contexts.get(1); @@ -204,12 +200,10 @@ public class DependencyFunction { * @throws DatabaseException */ @SCLValue(type = "ReadGraph -> Resource -> Variable -> String") - public static String noSuchVariableIssueDescription(ReadGraph graph, Resource converter, Variable issue) + public static String noSuchVariableIssueDescription(ReadGraph graph, Resource converter, Variable property) throws DatabaseException { - IssueResource ISSUE = IssueResource.getInstance(graph); - Resource issueResource = issue.getRepresents(graph); - Resource list = graph.getSingleObject(issueResource, ISSUE.Sources_DependencyTracker_Issue_HasContexts); - List contexts = ListUtils.toList(graph, list); + + List contexts = IssueUtils.getContextsForProperty(graph, property); Resource component = contexts.get(0); // Find all variables that are linked to component with arrows diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ExpressionIssueFunction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ExpressionIssueFunction.java index 8bc51ede..e21926a6 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ExpressionIssueFunction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ExpressionIssueFunction.java @@ -16,12 +16,11 @@ import java.util.List; 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.db.layer0.variable.Variable; import org.simantics.issues.common.Issue; +import org.simantics.issues.common.IssueUtils; import org.simantics.issues.common.StandardIssue; -import org.simantics.issues.ontology.IssueResource; import org.simantics.scl.reflection.annotations.SCLValue; import org.simantics.sysdyn.SysdynResource; @@ -56,11 +55,9 @@ public class ExpressionIssueFunction { } @SCLValue(type = "ReadGraph -> Resource -> Variable -> String") - public static String expressionIssueDescription(ReadGraph graph, Resource converter, Variable issue) throws DatabaseException { - IssueResource ISSUE = IssueResource.getInstance(graph); - Resource issueResource = issue.getRepresents(graph); - Resource list = graph.getSingleObject(issueResource, ISSUE.Sources_DependencyTracker_Issue_HasContexts); - List contexts = ListUtils.toList(graph, list); + public static String expressionIssueDescription(ReadGraph graph, Resource converter, Variable property) throws DatabaseException { + + List contexts = IssueUtils.getContextsForProperty(graph, property); Resource component = contexts.get(0); // There should be an error