]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / validation / ReportCollisions.java
diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java
new file mode 100644 (file)
index 0000000..e7346e9
--- /dev/null
@@ -0,0 +1,38 @@
+package org.simantics.graph.compiler.internal.validation;\r
+\r
+import java.util.Collection;\r
+\r
+import org.simantics.graph.compiler.internal.store.LocationStore;\r
+import org.simantics.graph.compiler.internal.templates.TemplateDefinitionStore;\r
+import org.simantics.graph.store.GraphStore;\r
+import org.simantics.ltk.Problem;\r
+\r
+public class ReportCollisions implements Runnable {\r
+       Collection<Problem> problems;\r
+       GraphStore store;\r
+\r
+       public ReportCollisions(\r
+                       Collection<Problem> problems,\r
+                       GraphStore store) {\r
+               this.problems = problems;\r
+               this.store = store;\r
+       }\r
+       \r
+       @Override\r
+       public void run() {\r
+               LocationStore locations = store.getStore(LocationStore.class);\r
+               for(int c : store.values.getCollisions().toArray())\r
+                       problems.add(new Problem(\r
+                                       locations.getLocation(c), \r
+                                       "Two literal values are given for the same resource."));\r
+               for(int c : store.identities.getCollisions().toArray())\r
+                       problems.add(new Problem(\r
+                                       locations.getLocation(c), \r
+                                       "Two different identities are given for the same resource."));\r
+               for(int c : store.getStore(TemplateDefinitionStore.class).getCollisions().toArray())\r
+                       problems.add(new Problem(\r
+                                       locations.getLocation(c), \r
+                                       "Two tempalate definitions are given for the same resource."));\r
+       }\r
+       \r
+}\r