From 675dc4d6b74f9179fd3df8f54a7d087c1bb467a8 Mon Sep 17 00:00:00 2001
From: Sebastian Krings <sebastian@krin.gs>
Date: Wed, 16 Jan 2013 14:26:01 +0100
Subject: [PATCH] moved config setter

---
 de.prob.units/src/de/prob/units/Activator.java      |  1 -
 .../src/de/prob/units/{sc => }/ConfSettor.java      | 13 ++++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
 rename de.prob.units/src/de/prob/units/{sc => }/ConfSettor.java (84%)

diff --git a/de.prob.units/src/de/prob/units/Activator.java b/de.prob.units/src/de/prob/units/Activator.java
index fba86f06..a867db55 100644
--- a/de.prob.units/src/de/prob/units/Activator.java
+++ b/de.prob.units/src/de/prob/units/Activator.java
@@ -4,7 +4,6 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.rodinp.core.RodinCore;
 
-import de.prob.units.sc.ConfSettor;
 
 /**
  * The activator class controls the plug-in life cycle
diff --git a/de.prob.units/src/de/prob/units/sc/ConfSettor.java b/de.prob.units/src/de/prob/units/ConfSettor.java
similarity index 84%
rename from de.prob.units/src/de/prob/units/sc/ConfSettor.java
rename to de.prob.units/src/de/prob/units/ConfSettor.java
index 1fc72506..c41716ec 100644
--- a/de.prob.units/src/de/prob/units/sc/ConfSettor.java
+++ b/de.prob.units/src/de/prob/units/ConfSettor.java
@@ -1,5 +1,6 @@
-package de.prob.units.sc;
+package de.prob.units;
 
+import org.eventb.core.IContextRoot;
 import org.eventb.core.IMachineRoot;
 import org.rodinp.core.ElementChangedEvent;
 import org.rodinp.core.IElementChangedListener;
@@ -12,8 +13,6 @@ import org.rodinp.core.IRodinFile;
 import org.rodinp.core.IRodinProject;
 import org.rodinp.core.RodinDBException;
 
-import de.prob.units.Activator;
-
 /**
  * Class that updates the configuration of files, to add the static checker
  * modules for our qualitative probabilistic reasoning plug-in.
@@ -53,6 +52,14 @@ public class ConfSettor implements IElementChangedListener {
 					mch.setConfiguration(conf + ";" + CONFIG, null);
 				}
 			}
+
+			if (root.getElementType().equals(IContextRoot.ELEMENT_TYPE)) {
+				final IContextRoot ctx = (IContextRoot) root;
+				final String conf = ctx.getConfiguration();
+				if (!conf.contains(CONFIG)) {
+					ctx.setConfiguration(conf + ";" + CONFIG, null);
+				}
+			}
 		}
 	}
 }
\ No newline at end of file
-- 
GitLab