Bug 105623 - [preferences] "restore defaults" has inconsistent behavior in project properties
Summary: [preferences] "restore defaults" has inconsistent behavior in project properties
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Martin Aeschlimann CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-29 20:07 EDT by Walter Harley CLA Friend
Modified: 2005-09-05 08:55 EDT (History)
3 users (show)

See Also:


Attachments
patch on OptionsConfigurationBlock.java (802 bytes, patch)
2005-08-02 05:02 EDT, Martin Aeschlimann CLA Friend
no flags Details | Diff
Picture of broken properties dialog (15.14 KB, image/png)
2005-09-02 10:23 EDT, Dani Megert CLA Friend
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Harley CLA Friend 2005-07-29 20:07:13 EDT
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".
Comment 1 Walter Harley CLA Friend 2005-07-29 20:13:15 EDT
I believe the problem is this code in OptionsConfigurationBlock:

  public void performDefaults() {
    DefaultScope defaultScope= new DefaultScope();
    //...

This should probably be something like:

  public void performDefaults() {
    Scope defaultScope= (fProject == null) ? 
      fLookupOrder[2] :   // DefaultScope
      fLookupOrder[1];    // InstanceScope
    // ...
Comment 2 Walter Harley CLA Friend 2005-07-29 20:22:59 EDT
Sorry, make that "IScopeContext", not "Scope".

I've tested this change and it does appear to cause the behavior that I think 
is right.
Comment 3 Dirk Baeumer CLA Friend 2005-07-30 17:48:49 EDT
Martin, can you please investigate ?
Comment 4 Martin Aeschlimann CLA Friend 2005-08-02 05:01:39 EDT
you're right. Fix released for 3.2 > 20050802

Dirk, do you want that for 3.1.1 (IMO not a major bug, but a trivial fix)
Comment 5 Martin Aeschlimann CLA Friend 2005-08-02 05:02:45 EDT
Created attachment 25543 [details]
patch on OptionsConfigurationBlock.java
Comment 6 Dirk Baeumer CLA Friend 2005-08-02 09:03:01 EDT
Can be annying. Approved for 3.1.1.

Reviewed patch and is ok for me.
Comment 7 Dirk Baeumer CLA Friend 2005-08-02 09:03:18 EDT
Reopening for 3.1.1 back porting.
Comment 8 Martin Aeschlimann CLA Friend 2005-08-02 10:11:10 EDT
Tom, can you do a second review?
Comment 9 Tom Hofmann CLA Friend 2005-08-03 06:54:59 EDT
reviewed the patch - ok.
Comment 10 Martin Aeschlimann CLA Friend 2005-08-03 07:01:41 EDT
released in 3.1.1 stream for M20050803
Comment 11 Dani Megert CLA Friend 2005-09-02 08:24:01 EDT
Start verification...
Comment 12 Dani Megert CLA Friend 2005-09-02 10:21:08 EDT
There are now problems with widget enablement:

1. set Workspace Compiler > Javadoc > 'Malformed Javadoc comments' setting to 
   'warning'
2. click 'OK'
3. open project properties of that preference
4. click 'Restore Defaults'
==> some of the widgets become visually enabled but in fact they are disabled.

This is at least as confusing as the 3.1 behavior and should be fixed.
Comment 13 Dani Megert CLA Friend 2005-09-02 10:23:41 EDT
Created attachment 26799 [details]
Picture of broken properties dialog
Comment 14 Martin Aeschlimann CLA Friend 2005-09-04 05:32:21 EDT
I would suggest that a new bug is filed for this so this one can be closed again.
Comment 15 Dani Megert CLA Friend 2005-09-05 03:58:41 EDT
Do as you like, however make sure that the new bug is targeted for 3.1.1.
Comment 16 Dirk Baeumer CLA Friend 2005-09-05 08:51:22 EDT
Daniel, you are normally one you prefers having new bugs instead of reopening
existing once if the bug reported got fixed ;-).

Opened bug 108793.

Daniel, can you please set the bug to verified if you agree that the problem
reported by this bug is fixed.

Comment 17 Dani Megert CLA Friend 2005-09-05 08:55:57 EDT
see comments above