[253700] Validation project preferences ignored from WTP 1.5.5 projects
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationConstants.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationConstants.java
index 18e6d44..16aef08 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationConstants.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationConstants.java
@@ -35,8 +35,7 @@
 	String ELEMENT_SEPARATOR = ";"; //$NON-NLS-1$ // separates the name of one IValidator from the next in the list of enabled validators for a project or preference
 	String DELEGATES_SEPARATOR = "="; //$NON-NLS-1$ // Separates the delegating validator id from the delegate validator id in the list of delegates
 
-	// The following values must match the attributes in the preference marker as shown in
-	// plugin.xml
+	// The following values must match the attributes in the preference marker as shown in plugin.xml
 	// Even though the plugin.xml values are not used to create new Preference or Project markers,
 	// maintaining one local name ensures that there's no confusion writing the migration code.
 	// These are the QualifiedNames used to persist the user's settings.
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
index e35981e..a797e65 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
@@ -11,7 +11,10 @@
 package org.eclipse.wst.validation.internal;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
@@ -87,6 +90,10 @@
 			return false;
 		}
 	}
+	
+	public boolean getDoesProjectOverride(){
+		return _doesProjectOverride;
+	}
 
 	public boolean doesProjectOverride() {
 		// If the global preference doesn't allow projects to override, it doesn't matter what the
@@ -586,10 +593,10 @@
 		final IEclipsePreferences pref = projectContext.getNode(ValidationPlugin.PLUGIN_ID);
 		if (pref != null) {
 			try {
-				pref.put(USER_PREFERENCE, serialize());
-				pref.put(USER_MANUAL_PREFERENCE, serializeManualSetting());
-				pref.put(USER_BUILD_PREFERENCE, serializeBuildSetting());
-				pref.put(DELEGATES_PREFERENCE, serializeDelegatesSetting());
+				pref.put(ValidationConfiguration.UserPreference, serialize());
+				pref.put(ValidationConfiguration.UserManualPreference, serializeManualSetting());
+				pref.put(ValidationConfiguration.UserBuildPreference, serializeBuildSetting());
+				pref.put(ValidationConfiguration.DelegatesPreference, serializeDelegatesSetting());
 				pref.flush();
 			} catch (BackingStoreException e) {
 				ValidationPlugin.getPlugin().handleException(e);
@@ -602,14 +609,56 @@
 		IScopeContext projectContext = new ProjectScope(project);
 		final IEclipsePreferences prefs = projectContext.getNode(ValidationPlugin.PLUGIN_ID);
 		if (prefs != null) {
-			String storedConfig = prefs.get(USER_PREFERENCE, DefaultValue);
+			String storedConfig = prefs.get(ValidationConfiguration.UserPreference, DefaultValue);
 			deserialize(storedConfig);
-			String storedManualConfig = prefs.get(USER_MANUAL_PREFERENCE, DefaultValue);
+			String storedManualConfig = prefs.get(ValidationConfiguration.UserManualPreference, DefaultValue);
 			deserializeManual(storedManualConfig);
-			String storedBuildConfig = prefs.get(USER_BUILD_PREFERENCE, DefaultValue);
+			String storedBuildConfig = prefs.get(ValidationConfiguration.UserBuildPreference, DefaultValue);
 			deserializeBuild(storedBuildConfig);
-			String storedDelegatesConfiguration = prefs.get(DELEGATES_PREFERENCE, DefaultValue);
+			String storedDelegatesConfiguration = prefs.get(ValidationConfiguration.DelegatesPreference, DefaultValue);
 			deserializeDelegates(storedDelegatesConfiguration);
 		}
 	}
+  
+  /**
+   * Answer the validator id's that have been enabled for manual validation.
+   * @return null if they are all enabled
+   */
+  Set<String> getEnabledManualValidators(){
+	  return getIds(ValidationConfiguration.UserManualPreference, ConfigurationConstants.ENABLED_MANUAL_VALIDATORS);
+  }
+  
+  /**
+   * Answer the validator id's that have been enabled for build validation.
+   * @return null if they are all enabled
+   */
+  Set<String> getEnabledBuildlValidators(){
+	  return getIds(ValidationConfiguration.UserBuildPreference, ConfigurationConstants.ENABLED_BUILD_VALIDATORS);
+  }
+  
+  /**
+   * A helper method to extract some validator id's from a preference store field.
+   * 
+   * @return null if all the validators are enabled.
+   */
+  private Set<String> getIds(String prefKey, String enabledPhrase){
+	IProject project = (IProject) getResource();
+	IScopeContext projectContext = new ProjectScope(project);
+	final IEclipsePreferences prefs = projectContext.getNode(ValidationPlugin.PLUGIN_ID);
+	if (prefs == null)return null;
+	
+	String storedConfig = prefs.get(prefKey, DefaultValue);
+	if (storedConfig == null || storedConfig.length() == 0 || storedConfig.equals(DefaultValue))return null;
+	int validationIndex = storedConfig.indexOf(enabledPhrase);
+
+	String ids = storedConfig.substring(validationIndex + enabledPhrase.length(),storedConfig.length());
+
+	StringTokenizer tokenizer = new StringTokenizer(ids, ConfigurationConstants.ELEMENT_SEPARATOR);
+	Set<String> set = new HashSet<String>(20);
+	while (tokenizer.hasMoreTokens())set.add(tokenizer.nextToken());
+	if (set.size() == 0)return null;
+	  
+	return set;
+	  
+  }
 }
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
index d1efaf6..7f82711 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
@@ -54,10 +54,16 @@
 	protected Map<ValidatorMetaData, Boolean> 	manualValidators;
 	protected Map<ValidatorMetaData, Boolean> 	buildValidators;
 	
-	protected String USER_PREFERENCE 		= "USER_PREFERENCE"; //$NON-NLS-1$
-	protected String USER_MANUAL_PREFERENCE = "USER_MANUAL_PREFERENCE"; //$NON-NLS-1$
-	protected String USER_BUILD_PREFERENCE 	= "USER_BUILD_PREFERENCE"; //$NON-NLS-1$
-	protected String DELEGATES_PREFERENCE 	= "DELEGATES_PREFERENCE"; //$NON-NLS-1$
+	protected static final String UserPreference = "USER_PREFERENCE"; //$NON-NLS-1$
+	protected static final String UserBuildPreference = "USER_BUILD_PREFERENCE"; //$NON-NLS-1$
+	protected static final String UserManualPreference = "USER_MANUAL_PREFERENCE"; //$NON-NLS-1$
+	protected static final String DelegatesPreference = "DELEGATES_PREFERENCE"; //$NON-NLS-1$
+	
+	// GRK - I am keeping these "constants" in the off chance that they were used somewhere outside the framework
+	protected String USER_PREFERENCE 		= UserPreference;
+	protected String USER_MANUAL_PREFERENCE = UserManualPreference;
+	protected String USER_BUILD_PREFERENCE 	= UserBuildPreference;
+	protected String DELEGATES_PREFERENCE 	= DelegatesPreference;
 	
 	/**
 	 * The key is the target id, that is the id of the place holder validator. The value is the id 
@@ -124,6 +130,33 @@
 
 		return result;
 	}
+	
+	/**
+	 * Answer the validators
+	 * @return
+	 */
+	public static Set<String> getValidatorIdsManual(){
+		String config = null;
+		Preferences prefs = ValidationPlugin.getPlugin().getPluginPreferences();
+		if (prefs != null)config = prefs.getString(UserManualPreference);
+		return getValidatorIds(config);
+	}
+	
+	public static Set<String> getValidatorIdsBuild(){
+		String config = null;
+		Preferences prefs = ValidationPlugin.getPlugin().getPluginPreferences();
+		if (prefs != null)config = prefs.getString(UserBuildPreference);
+		return getValidatorIds(config);
+	}
+	
+	private static Set<String> getValidatorIds(String elements){
+		Set<String> set = new HashSet<String>(50);
+		if (elements != null){
+			StringTokenizer tokenizer = new StringTokenizer(elements, ConfigurationConstants.ELEMENT_SEPARATOR);
+			while (tokenizer.hasMoreTokens())set.add(tokenizer.nextToken());
+		}
+		return set;
+	}
 
 	public static IWorkspaceRoot getRoot() {
 		return ResourcesPlugin.getWorkspace().getRoot();
@@ -542,14 +575,14 @@
 		if (pref != null) {
 			try {
 				OutputStream os = new ByteArrayOutputStream();
-				pref.setValue(USER_PREFERENCE, serialize());
-				pref.store(os, USER_PREFERENCE);
-				pref.setValue(USER_MANUAL_PREFERENCE, serializeManualSetting());
-				pref.store(os, USER_MANUAL_PREFERENCE);
-				pref.setValue(USER_BUILD_PREFERENCE, serializeBuildSetting());
-				pref.store(os, USER_BUILD_PREFERENCE);
-				pref.setValue(DELEGATES_PREFERENCE, serializeDelegatesSetting());
-				pref.store(os, DELEGATES_PREFERENCE);
+				pref.setValue(ValidationConfiguration.UserPreference, serialize());
+				pref.store(os, ValidationConfiguration.UserPreference);
+				pref.setValue(ValidationConfiguration.UserManualPreference, serializeManualSetting());
+				pref.store(os, ValidationConfiguration.UserManualPreference);
+				pref.setValue(ValidationConfiguration.UserBuildPreference, serializeBuildSetting());
+				pref.store(os, ValidationConfiguration.UserBuildPreference);
+				pref.setValue(ValidationConfiguration.DelegatesPreference, serializeDelegatesSetting());
+				pref.store(os, ValidationConfiguration.DelegatesPreference);
 			} catch (IOException e) {
 				ValidationPlugin.getPlugin().handleException(e);
 			}
@@ -696,13 +729,13 @@
 	 * @throws InvocationTargetException
 	 */
 	private void deserializeAllPrefs(Preferences prefs) throws InvocationTargetException {
-		String storedConfig = prefs.getString(USER_PREFERENCE);
+		String storedConfig = prefs.getString(ValidationConfiguration.UserPreference);
 		deserialize(storedConfig);
-		String storedManualConfig = prefs.getString(USER_MANUAL_PREFERENCE);
+		String storedManualConfig = prefs.getString(ValidationConfiguration.UserManualPreference);
 		deserializeManual(storedManualConfig);
-		String storedBuildConfig = prefs.getString(USER_BUILD_PREFERENCE);
+		String storedBuildConfig = prefs.getString(ValidationConfiguration.UserBuildPreference);
 		deserializeBuild(storedBuildConfig);
-		String storedDelegatesConfiguration = prefs.getString(DELEGATES_PREFERENCE);
+		String storedDelegatesConfiguration = prefs.getString(ValidationConfiguration.DelegatesPreference);
 		deserializeDelegates(storedDelegatesConfiguration);
 	}
 	
@@ -720,13 +753,13 @@
 
 	private void deserializeAllPrefs(PropertyChangeEvent event) throws InvocationTargetException {
 		String storedConfig = (String)event.getNewValue();
-		if( event.getProperty().equals(USER_PREFERENCE) ){
+		if( event.getProperty().equals(ValidationConfiguration.UserPreference) ){
 			deserialize(storedConfig);
-		}else if(event.getProperty().equals(USER_MANUAL_PREFERENCE)){
+		}else if(event.getProperty().equals(ValidationConfiguration.UserManualPreference)){
 			deserializeManual(storedConfig);
-		}else if(event.getProperty().equals(USER_BUILD_PREFERENCE)){
+		}else if(event.getProperty().equals(ValidationConfiguration.UserBuildPreference)){
 			deserializeBuild(storedConfig);
-		}else if(event.getProperty().equals(DELEGATES_PREFERENCE)){
+		}else if(event.getProperty().equals(ValidationConfiguration.DelegatesPreference)){
 			deserializeDelegates(storedConfig);
 		}
 	}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Friend.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Friend.java
index 54f84d7..4146636 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Friend.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Friend.java
@@ -47,8 +47,11 @@
 	public static boolean shouldValidate(Validator validator, IResource resource, ValType valType, 
 		ContentTypeWrapper contentTypeWrapper){
 		
-		return validator.shouldValidate(resource, valType, contentTypeWrapper);
-		
+		return validator.shouldValidate(resource, valType, contentTypeWrapper);		
+	}
+	
+	public static void setMigrated(Validator validator, boolean migrated){
+		validator.setMigrated(migrated);
 	}
 
 }
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
index 2e65ba7..ce9cc31 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
@@ -114,6 +114,13 @@
 	/** How many times has a message field in this validator been changed since it was created (or copied)? */
 	protected transient int _changeCountMessages;
 	
+	/** Has the validator been migrated from an earlier version in this session, but not yet saved? */
+	private boolean _migrated;
+		
+	void setMigrated(boolean migrated){
+		_migrated = migrated;
+	}
+	
 	/**
 	 * Create a new validator based on a abstract validator.
 	 * 
@@ -170,7 +177,7 @@
 	 * Compare yourself based on Validator name.
 	 */
 	public int compareTo(Validator validator) {
-			return getName().compareTo(validator.getName());			
+		return getName().compareTo(validator.getName());			
 	}
 	
 	/** Answer a deep copy of yourself. */
@@ -192,6 +199,7 @@
 		_project = v._project;
 		_sourceId = v._sourceId;
 		_version = v._version;
+		_migrated = v._migrated;
 		
 		if (includeChangeCounts){
 			_changeCountGlobal = v._changeCountGlobal;
@@ -491,10 +499,10 @@
 	}
 	
 	/**
-	 * Has the validator changed since it was last created or copied?
+	 * Has the validator changed since it was last created or copied? Or was it migrated from an earlier version. 
 	 */
 	public boolean isChanged(){
-		if (_changeCountGlobal > 0 || _changeCountMessages > 0)return true;
+		if (_changeCountGlobal > 0 || _changeCountMessages > 0 || _migrated)return true;
 		return false;
 	}
 	
@@ -1227,6 +1235,7 @@
 	_version = validator._version;
 	_changeCountGlobal = validator._changeCountGlobal;
 	_changeCountMessages = validator._changeCountMessages;
+	_migrated = validator._migrated;
 }
 
 void setMessages(Map<String, MessageSeveritySetting> map) {
@@ -1238,6 +1247,10 @@
 	return _changeCountGlobal;
 }
 
+public boolean hasGlobalChanges(){
+	return _migrated || _changeCountGlobal > 0;
+}
+
 public int getChangeCountMessages() {
 	return _changeCountMessages;
 }
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
index 4fc849f..1865096 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
@@ -274,7 +274,7 @@
 	 *            This may be null, in which case only the global preferences
 	 *            are used.
 	 * @param mustUseProjectSettings
-	 *            Force the project properties to be used. There is a case where the used has toggled the
+	 *            Force the project properties to be used. There is a case where the user has toggled the
 	 *            Enable project specific settings checkbox in the dialog, but has not yet committed the
 	 *            changes. This allows that setting to be passed through.
 	 *            
@@ -291,6 +291,8 @@
 				ValPrefManagerProject vpm = new ValPrefManagerProject(project);
 				vals = vpm.getValidators(extVals);
 				for (Validator v : vals)extVals.put(v.getId(), v);
+				
+				for (Validator v : getProjectPreferences(project).getValidators())extVals.put(v.getId(), v);
 			}		
 		}
 		catch (BackingStoreException e){
@@ -311,13 +313,10 @@
 		if (project == null)return true;
 		if (!getGlobalPreferences().getOverride())return true;
 		ProjectPreferences pp = getProjectPreferences2(project);
-		if (pp == null){
-			ValPrefManagerProject vpm = new ValPrefManagerProject(project);
-			pp = new ProjectPreferences(project); 
-			vpm.loadProjectPreferencesShallow(pp);
-		}
+		if (pp != null)return !pp.getOverride();
 		
-		return !pp.getOverride();
+		ValPrefManagerProject vpm = new ValPrefManagerProject(project);
+		return !vpm.getOverride();
 	}
 	
 	/**
@@ -844,7 +843,8 @@
 	 * @param project The project that has been opened, created, or had it's description change.
 	 */
 	public void projectChanged(IProject project){
-		_projectManager.change(project);		
+		_projectManager.change(project);
+		_projectPreferences.remove(project);
 	}
 	
 	/**
@@ -855,6 +855,7 @@
 	 */
 	public void projectRemoved(IProject project){
 		_projectManager.remove(project);
+		_projectPreferences.remove(project);
 	}
 	
 	private void putValProperty(ValProperty vp, IResource resource, ValType valType) {
@@ -1058,6 +1059,10 @@
 		/**
 		 * This is used to keep track of which validators are enabled for which projects. We want to ensure
 		 * that we don't activate a validator (and it's plug-in) if it has nothing to validate in the workspace.
+		 * <p>
+		 * There are two reasons why a validator may not be enabled. It's current project level filters may not match
+		 * the project. Or the entire validator may have been turned off for the project. 
+		 * </p>
 		 * @author karasiuk
 		 *
 		 */
@@ -1067,8 +1072,10 @@
 			 * <p>
 			 * I've gone back and forth on whether the key should
 			 * be a Validator or the validator id. I'm back to it being the id because I was
-			 * running into cases where because of copying I wasn't getting the matches that I expected. If I run into
+			 * running into cases where because of copying I wasn't getting the matches that I expected and I
+			 * want to ensure that I don't leak validators. If I run into
 			 * false matches, it is probably because reset isn't being called when it should be.
+			 * </p>
 			 */
 			private Map<String, Set<IProject>> _map = new HashMap<String, Set<IProject>>(50);
 			
@@ -1110,6 +1117,9 @@
 				}
 			}
 			
+			/**
+			 * For each of the projects in the workspace, load which validators are currently prepared to validate things.
+			 */
 			private Map<String, Set<IProject>> load() {
 				Map<String, Set<IProject>> map = new HashMap<String, Set<IProject>>(50);
 				ValManager vm = ValManager.getDefault();
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
index 5a587d1..5bde05a 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
@@ -17,6 +17,7 @@
 import java.util.Map;
 
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.wst.validation.Friend;
 import org.eclipse.wst.validation.MessageSeveritySetting;
 import org.eclipse.wst.validation.ValidationFramework;
 import org.eclipse.wst.validation.Validator;
@@ -290,10 +291,11 @@
 			return;
 		}
 		if (!validator.isChanged())return;
-		if (validator.getChangeCountGlobal() > 0){
+		if (validator.hasGlobalChanges()){
 			Global g = new Global(validator.isManualValidation(), validator.isBuildValidation(), validator.getVersion(),
 				validator.getDelegatingId());
 			vp.put(PrefConstants.global, g.serialize());
+			Friend.setMigrated(validator, false);
 		}
 		
 		if (validator.getChangeCountMessages() > 0){
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
index 561358c..b3a10fd 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.wst.validation.internal;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -21,6 +22,7 @@
 import org.eclipse.core.resources.ProjectScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.wst.validation.Friend;
 import org.eclipse.wst.validation.MessageSeveritySetting;
 import org.eclipse.wst.validation.Validator;
 import org.eclipse.wst.validation.Validator.V2;
@@ -39,6 +41,11 @@
 	private IProject	_project;
 	private static List<IValChangedListener> _listeners = new LinkedList<IValChangedListener>();
 	
+	/**
+	 * The validators that are in the project preference file, but have
+	 * only been configured to the global preference level. That is they have not had
+	 * any project level customizations applied yet.
+	 */
 	private List<Validator> _validators;
 	
 	public ValPrefManagerProject(IProject project){
@@ -66,15 +73,12 @@
 	 * @return true if it has settings. This does not mean that the settings are enabled, only that it
 	 * has settings.
 	 * 
-	 * @see ValManager#hasEnabledProjectPreferences(IProject)
+	 * @deprecated
 	 */
 	public boolean hasProjectSpecificSettings(){
 		IEclipsePreferences pref = getPreferences();
 		
 		if (pref == null)return false;
-		int version = pref.getInt(PrefConstants.frameworkVersion, 0);
-		if (version == 0)return false;
-
 		return true;
 	}
 	
@@ -106,7 +110,7 @@
 	 *         any project level customizations applied yet.
 	 */
 	private List<Validator> loadValidators(Map<String, Validator> baseValidators) throws BackingStoreException {
-		LinkedList<Validator> list = new LinkedList<Validator>();
+		List<Validator> list = new LinkedList<Validator>();
 		IEclipsePreferences pref = getPreferences();
 		if (pref.nodeExists(PrefConstants.vals)){
 			Preferences vals = pref.node(PrefConstants.vals);
@@ -126,23 +130,81 @@
 	/**
 	 * Update the project preferences from the preference store.
 	 * @return false if the project does not have any specific preferences.
+	 * 
+	 * @deprecated
 	 */
 	public boolean loadProjectPreferencesShallow(ProjectPreferences pp) {
 		IEclipsePreferences pref = getPreferences();
 		
 		if (pref == null)return false;
-		int version = pref.getInt(PrefConstants.frameworkVersion, 0);
-		if (version == 0)return false;
 		
-		if (version != ValPrefManagerGlobal.frameworkVersion)ValPrefManagerGlobal.migrate(version, pref);
-
 		pp.setOverride(pref.getBoolean(PrefConstants.override, ProjectPreferences.DefaultOverride));
 		pp.setSuspend(pref.getBoolean(PrefConstants.suspend, ProjectPreferences.DefaultSuspend));
 		return true;
 	}
 	
+	/**
+	 * Answer the setting of the getOverride field.
+	 */
+	public boolean getOverride(){
+		IEclipsePreferences pref = getPreferences();
+		
+		if (pref == null)return ProjectPreferences.DefaultOverride;
+		int version = pref.getInt(PrefConstants.frameworkVersion, 0);
+		if (version == 0){
+			try {
+				ProjectConfiguration pc = ConfigurationManager.getManager().getProjectConfiguration(_project);
+				return pc.getDoesProjectOverride();
+			}
+			catch (InvocationTargetException e){
+				// eat it, if it fails we just go with the defaults
+			}
+		}
+		return pref.getBoolean(PrefConstants.override, ProjectPreferences.DefaultOverride);
+	}
+
+	private void migrateFromBeforeWTP30(ProjectPreferences pp, Map<String, Validator> baseValidators) {
+		try {
+			ProjectConfiguration pc = ConfigurationManager.getManager().getProjectConfiguration(pp.getProject());
+			pp.setSuspend(pc.isDisableAllValidation());
+			pp.setOverride(pc.getDoesProjectOverride());
+			
+			List<Validator> list = migrateFromBeforeWTP30(baseValidators, pc);
+			Validator[] vals = new Validator[list.size()];
+			list.toArray(vals);
+			pp.setValidators(vals);			
+		}
+		catch (InvocationTargetException e){
+			// eat it, if it fails we just go with the defaults
+		}
+	}
+
+	private List<Validator> migrateFromBeforeWTP30(Map<String, Validator> baseValidators, ProjectConfiguration pc)
+			throws InvocationTargetException {
+				
+		Set<String> build = pc.getEnabledBuildlValidators();
+		Set<String> manual = pc.getEnabledManualValidators();
+		
+		List<Validator> list = new LinkedList<Validator>();
+		for (Validator v : baseValidators.values()){
+			V2 v2 = v.asV2Validator();
+			if (v2 != null){
+				boolean isBuild = build == null || build.contains(v2.getValidatorClassname());
+				boolean isManual = manual == null || manual.contains(v2.getValidatorClassname());
+				if ((v.isBuildValidation() != isBuild) || (v.isManualValidation() != isManual)){
+					V2 copy = v2.copy().asV2Validator();
+					copy.setBuildValidation(isBuild);
+					copy.setManualValidation(isManual);
+					copy.setLevel(Validator.Level.Project);
+					Friend.setMigrated(copy, true);
+					list.add(copy);
+				}
+			}
+		}
+		return list;
+	}
 	
-	//FIXME I suspect that this method should be removed	
+	
 	/**
 	 * Update the project preferences from the preference store.
 	 * @return false if the project does not have any specific preferences.
@@ -150,9 +212,21 @@
 	public boolean loadProjectPreferences(ProjectPreferences pp, Map<String, Validator> baseValidators) 
 		throws BackingStoreException {
 		
-		if (!loadProjectPreferencesShallow(pp))return false;
-		
 		IEclipsePreferences pref = getPreferences();
+
+		if (pref == null)return false;
+		int version = pref.getInt(PrefConstants.frameworkVersion, 0);
+		if (version == 0){
+			// This means that we have a project that is before WTP 3.0
+			migrateFromBeforeWTP30(pp, baseValidators);
+			return true;
+		}
+		
+		if (version != ValPrefManagerGlobal.frameworkVersion)ValPrefManagerGlobal.migrate(version, pref);
+
+		pp.setOverride(pref.getBoolean(PrefConstants.override, ProjectPreferences.DefaultOverride));
+		pp.setSuspend(pref.getBoolean(PrefConstants.suspend, ProjectPreferences.DefaultSuspend));
+		
 		if (!pref.nodeExists(PrefConstants.vals))return true;
 		
 		Preferences vp = pref.node(PrefConstants.vals);
@@ -187,6 +261,7 @@
 		try {
 			Validator[] workspaceVals = ValManager.getDefault().getValidators();
 			Map<String, Validator> base = new HashMap<String, Validator>(workspaceVals.length);
+			for (Validator v : workspaceVals)base.put(v.getId(), v);
 			for (Validator v : validators)ValPrefManagerGlobal.save(v, vals, base);
 			pref.flush();
 			ProjectConfiguration pc = ConfigurationManager.getManager()