X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fvalidation%2FReportCollisions.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fvalidation%2FReportCollisions.java;h=e7346e94570c92edd76c0e46e4df56b2b87935d0;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 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 index 000000000..e7346e945 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java @@ -0,0 +1,38 @@ +package org.simantics.graph.compiler.internal.validation; + +import java.util.Collection; + +import org.simantics.graph.compiler.internal.store.LocationStore; +import org.simantics.graph.compiler.internal.templates.TemplateDefinitionStore; +import org.simantics.graph.store.GraphStore; +import org.simantics.ltk.Problem; + +public class ReportCollisions implements Runnable { + Collection problems; + GraphStore store; + + public ReportCollisions( + Collection problems, + GraphStore store) { + this.problems = problems; + this.store = store; + } + + @Override + public void run() { + LocationStore locations = store.getStore(LocationStore.class); + for(int c : store.values.getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two literal values are given for the same resource.")); + for(int c : store.identities.getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two different identities are given for the same resource.")); + for(int c : store.getStore(TemplateDefinitionStore.class).getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two tempalate definitions are given for the same resource.")); + } + +}