summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTom Hochstein2013-06-27 09:55:47 (EDT)
committer Dani Megert2013-06-27 09:55:47 (EDT)
commit59911823d58de77541ca51edf6b03ee3d1be86a0 (patch)
tree120fbf805bfc1a533f20ba5baf6dd5cdf03bb02d
parente50e409cac876b6ba9e3158649b52cdd2e6880dc (diff)
downloadeclipse.platform.ui-59911823d58de77541ca51edf6b03ee3d1be86a0.zip
eclipse.platform.ui-59911823d58de77541ca51edf6b03ee3d1be86a0.tar.gz
eclipse.platform.ui-59911823d58de77541ca51edf6b03ee3d1be86a0.tar.bz2
Fixed bug 409996: 'Restore Defaults' does not work properly on Project
Properties > Resource tab
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java
index 295f8ec..32e95da 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Tom Hochstein (Freescale) - Bug 409996 - 'Restore Defaults' does not work properly on Project Properties > Resource tab
*******************************************************************************/
package org.eclipse.ui.ide.dialogs;
@@ -161,16 +162,17 @@ public final class ResourceEncodingFieldEditor extends
// return node.nodeExists(path) ? node.node(path).getBoolean(ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS, false) : false;
// for now, take the long way
if (!node.nodeExists(projectName))
- return false;
+ return ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS;
node = node.node(projectName);
if (!node.nodeExists(ResourcesPlugin.PI_RESOURCES))
- return false;
+ return ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS;
node = node.node(ResourcesPlugin.PI_RESOURCES);
return node.getBoolean(
- ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS, false);
+ ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS,
+ ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS);
} catch (BackingStoreException e) {
// default value
- return false;
+ return ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS;
}
}
@@ -253,10 +255,12 @@ public final class ResourceEncodingFieldEditor extends
}
if (!hasSameSeparateDerivedEncodings) {
Preferences prefs = new ProjectScope((IProject) resource).getNode(ResourcesPlugin.PI_RESOURCES);
- if (getStoredSeparateDerivedEncodingsValue())
+ boolean newValue = !getStoredSeparateDerivedEncodingsValue();
+ // Remove the pref if it's the default, otherwise store it.
+ if (newValue == ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS)
prefs.remove(ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS);
else
- prefs.putBoolean(ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS, true);
+ prefs.putBoolean(ResourcesPlugin.PREF_SEPARATE_DERIVED_ENCODINGS, newValue);
prefs.flush();
}
return Status.OK_STATUS;
@@ -317,8 +321,8 @@ public final class ResourceEncodingFieldEditor extends
protected void doLoadDefault() {
super.doLoadDefault();
if (separateDerivedEncodingsButton != null)
- separateDerivedEncodingsButton
- .setSelection(getStoredSeparateDerivedEncodingsValue());
+ separateDerivedEncodingsButton.setSelection(
+ ResourcesPlugin.DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS);
}
/*