Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Jouault2015-03-27 03:09:07 -0400
committerFrédéric Jouault2015-03-27 03:09:07 -0400
commit1c45ac4fbc337f734983730e8836cb1ad4f8b09c (patch)
tree6d2a99fb170216e2e00498d4dff608649d6a25a8
parenta9aef2ddf017bc9bea5b29c5e401f51977628c0c (diff)
downloadorg.eclipse.atl.tcs-1c45ac4fbc337f734983730e8836cb1ad4f8b09c.tar.gz
org.eclipse.atl.tcs-1c45ac4fbc337f734983730e8836cb1ad4f8b09c.tar.xz
org.eclipse.atl.tcs-1c45ac4fbc337f734983730e8836cb1ad4f8b09c.zip
improved RefSettings sorting (e.g., so that autoCreation comes before lookIns)
-rw-r--r--plugins/org.eclipse.gmt.tcs.injector/src/org/eclipse/gmt/tcs/injector/ParserLauncher.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmt.tcs.injector/src/org/eclipse/gmt/tcs/injector/ParserLauncher.java b/plugins/org.eclipse.gmt.tcs.injector/src/org/eclipse/gmt/tcs/injector/ParserLauncher.java
index 6306152..0c68c6e 100644
--- a/plugins/org.eclipse.gmt.tcs.injector/src/org/eclipse/gmt/tcs/injector/ParserLauncher.java
+++ b/plugins/org.eclipse.gmt.tcs.injector/src/org/eclipse/gmt/tcs/injector/ParserLauncher.java
@@ -78,6 +78,21 @@ public class ParserLauncher {
}
// if(runtime.getNbErrors() == 0) {
+ // A RefSetting that can autoCreate an element should come before other
+ // RefSettings that might refer to this element.
+ Collections.sort(refSettings, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ RefSetting rs1 = (RefSetting)o1;
+ RefSetting rs2 = (RefSetting)o2;
+ if(rs1.canAutoCreate() && !rs2.canAutoCreate())
+ return -1; // autoCreate first
+ else if(rs2.canAutoCreate() && !rs1.canAutoCreate())
+ return 1; // autoCreate first
+ else // both or none are autoCreate
+ return 0; // don't care
+ }
+ });
+
// A RefSetting that relies on imported contexts can only be executed after
// the RefSetting importing the corresponding context (and this, recursively).
// For now, we sort RefSettings so that all those that import a context

Back to the top