Project: JDT
Bug 105623 [preferences] "restore defaults" has inconsistent behavior in project properties
Reported: 2005-07-29 20:07:13 | Status: verified fixed

On each of the JDT project property panes, "restore defaults" clears the "enable project specific settings" checkbox, disables the rest of the preference fields, and sets their displayed (greyed) contents to default. However, it evidently sets the displayed content to *factory* default. This is misleading, because if workspace preferences have been changed from factory defaults, it is the workspace settings that will be in effect after "restore defaults" in a project property pane. It can also create a misleading situation if the user checks the "enable project specific settings" checkbox, because the fields will be re-enabled and will contain factory default rather than current workspace preferences. To see this in action: 1. Go to workspace preferences, Java / Compiler / Building. Click "restore defaults" to restore factory defaults. Note that "max number of problems" is 100, and "enable use of exclusion patterns" is checked. 2. Change "max number of problems" to 50, and clear "enable use of exclusion patterns. Click OK. 3. Create a new Java project (or edit an existing one with defaulted values). View its project properties, Java / Compiler / Building. Note that the values displayed are the workspace settings (50, unchecked). 4. Click "restore defaults". Note that the "enable project specific settings" is unchecked, and the displayed values of the settings change to 100 and checked, that is, to the factory defaults. (This happens regardless of whether the project specific settings checkbox had been checked, and regardless of whether the values had been changed.) EXPECTED: values should be 50/unchecked, same as workspace preferences. 5. Click OK to dismiss the property pane; then launch it again. Note that the values have (correctly) returned to the workspace values, 50/unchecked. So despite the misleading display, "restore defaults" actually led us to the current workspace preferences. 6. Click "restore defaults"; note settings change back to 100/checked. Now check "enable project specific settings". Note settings are still 100/checked. 7. Click OK to dismiss the property pane; then launch it again. Note that settings are 100/checked. In this case, "restore defaults" led us to factory defaults. So depending on the precise set of operations, "restore defaults" has two different meanings. EXPECTED: "restore defaults", in a project properties pane, should ALWAYS mean "return to current workspace settings".

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/OptionsConfigurationBlock.java