[244074] inconsistency when switching from project specific preferences to global preferences
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
index 4fe669d..7324b51 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
@@ -263,7 +263,7 @@
}
public Composite createPage(Composite parent) throws InvocationTargetException {
- _validators = copyValidators(ValManager.getDefault().getValidatorsConfiguredForProject(getProject()));
+ _validators = copyValidators(ValManager.getDefault().getValidatorsConfiguredForProject(getProject(), false));
Composite validatorGroup = new Composite(parent, SWT.NONE);
@@ -511,7 +511,11 @@
_override.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
_override.setFocus();
- if (ValManager.getDefault().getGlobalPreferences().getOverride()){
+ ValManager vm = ValManager.getDefault();
+ if (vm.getGlobalPreferences().getOverride()){
+ IProject project = getProject();
+ _validators = copyValidators(vm.getValidatorsConfiguredForProject(project, _override.getSelection()));
+ _validatorList.setInput(_validators);
enableDisableWidgets();
_validatorList.refresh();
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
index 13e799c..1f246f3 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
@@ -277,7 +277,7 @@
* @throws ProjectUnavailableError
*/
public Validator[] getValidatorsConfiguredForProject(IProject project) throws ProjectUnavailableError {
- Validator[] orig = ValManager.getDefault().getValidatorsConfiguredForProject(project);
+ Validator[] orig = ValManager.getDefault().getValidatorsConfiguredForProject(project, false);
Validator[] copy = new Validator[orig.length];
for (int i=0; i<orig.length; i++)copy[i] = orig[i].copy();
return copy;
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 b1a5e83..cec6825 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
@@ -185,7 +185,7 @@
* @return The validators in name sorted order.
*/
public synchronized Validator[] getValidators(IProject project) throws ProjectUnavailableError {
- Map<String,Validator> v2Vals = getV2Validators(project);
+ Map<String,Validator> v2Vals = getV2Validators(project, false);
TreeSet<Validator> sorted = new TreeSet<Validator>();
sorted.addAll(v2Vals.values());
@@ -223,12 +223,16 @@
*
* @param project
* The project that the configuration is based on.
+ * @param mustUseProjectSettings
+ * 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.
* @return The validators that are configured to run on this project based
* on the project level settings. These are the "live" validators, they are not copies.
* @throws ProjectUnavailableError
*/
- public Validator[] getValidatorsConfiguredForProject(IProject project) throws ProjectUnavailableError {
- Map<String,Validator> v2Vals = getV2Validators(project);
+ public Validator[] getValidatorsConfiguredForProject(IProject project, boolean mustUseProjectSettings) throws ProjectUnavailableError {
+ Map<String,Validator> v2Vals = getV2Validators(project, mustUseProjectSettings);
TreeSet<Validator> sorted = new TreeSet<Validator>();
sorted.addAll(v2Vals.values());
@@ -255,24 +259,32 @@
}
/**
- * Answer the V2 validators that are in effect for this project. The following approach is used:
+ * Answer the V2 validators that are in effect for this project. The
+ * following approach is used:
* <ol>
* <li>The validators that are defined by the extension point are loaded.</li>
* <li>They are customized by any global preferences.</li>
- * <li>If project customizations are allowed, they are customized by the project preferences.
+ * <li>If project customizations are allowed, they are customized by the
+ * project preferences.
* </ol>
*
* @param project
- * This may be null, in which case only the global preferences are used.
+ * 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
+ * Enable project specific settings checkbox in the dialog, but has not yet committed the
+ * changes. This allows that setting to be passed through.
+ *
* @return
*/
- private Map<String,Validator> getV2Validators(IProject project){
+ private Map<String,Validator> getV2Validators(IProject project, boolean mustUseProjectSettings){
Map<String,Validator> extVals = ExtensionValidators.instance().getMapV2Copy();
try {
List<Validator> vals = ValPrefManagerGlobal.getDefault().getValidators();
for (Validator v : vals)extVals.put(v.getId(), v);
- if (!mustUseGlobalValidators(project)){
+ if (mustUseProjectSettings || !mustUseGlobalValidators(project)){
//TODO should probably cache this vpm
ValPrefManagerProject vpm = new ValPrefManagerProject(project);
vals = vpm.getValidators(extVals);