Bug 121057 - [jres] 'Execution Environments' preference page not updated after JRE addition
Summary: [jres] 'Execution Environments' preference page not updated after JRE addition
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal with 2 votes (vote)
Target Milestone: 4.5 M5   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 143914 144391 174239 181456 183205 215456 263886 280408 319093 352401 401438 419993 (view as bug list)
Depends on: 81202 455556
Blocks: 246239
  Show dependency tree
 
Reported: 2005-12-15 10:21 EST by Markus Keller CLA
Modified: 2015-01-19 04:20 EST (History)
19 users (show)

See Also:
daniel_megert: review-
daniel_megert: review-
daniel_megert: review-
daniel_megert: review+


Attachments
Addition of only Apply button in Preference Page (3.12 KB, patch)
2014-11-11 03:32 EST, Sarika Sinha CLA
no flags Details | Diff
Debug patch to support Apply in JREs Preference page (8.39 KB, patch)
2014-11-11 03:33 EST, Sarika Sinha CLA
no flags Details | Diff
UI patch to support Apply in Build Path Preference page (1.07 KB, patch)
2014-11-11 03:34 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
Addition of only Apply button in Preference Page (3.65 KB, patch)
2014-11-25 04:05 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
Debug patch to support Apply in JREs Preference page (8.35 KB, patch)
2014-11-25 04:06 EST, Sarika Sinha CLA
no flags Details | Diff
UI patch to support Apply in Build Path Preference page (2.13 KB, patch)
2014-11-25 04:07 EST, Sarika Sinha CLA
no flags Details | Diff
Warning Dialog (105.89 KB, image/png)
2014-12-03 04:39 EST, Sarika Sinha CLA
no flags Details
Addition of only Apply button in Preference Page (3.65 KB, patch)
2014-12-03 05:21 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
Debug patch to support Apply in JREs Preference page (8.52 KB, patch)
2014-12-03 05:22 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
UI patch to support Apply in Build Path Preference page (2.14 KB, patch)
2014-12-03 05:26 EST, Sarika Sinha CLA
no flags Details | Diff
UI patch to support Apply in Build Path Preference page Approach 1 (5.79 KB, patch)
2014-12-09 06:32 EST, Sarika Sinha CLA
no flags Details | Diff
UI patch to support Apply in Build Path Preference page Approach 2 (5.04 KB, patch)
2014-12-09 06:33 EST, Sarika Sinha CLA
daniel_megert: review-
Details | Diff
UI patch to only show 'Apply' button in PreferencePage Approach 1 (5.81 KB, patch)
2014-12-16 06:01 EST, Sarika Sinha CLA
daniel_megert: review+
Details | Diff
Debug patch to support Apply in JREs Preference page (8.37 KB, patch)
2014-12-18 02:50 EST, Sarika Sinha CLA
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-12-15 10:21:22 EST
I20051214-2000

- start with a new workspace and a 1.4 VM
- on the 'Installed JREs' page, add a 1.5 SDK
- without leaving the preferences dialog, go to the 'Execution Environments' page and select J2SE-1.5
=> compatible JREs list is empty, although I just installed one
Comment 1 Darin Wright CLA 2005-12-15 10:26:27 EST
The page should udpate when JREs are added/removed (but the user will have to press Apply on the installed JREs page for this to happen).
Comment 2 Darin Wright CLA 2006-04-17 15:36:51 EDT
Deferred
Comment 3 Darin Wright CLA 2006-05-29 11:54:03 EDT
*** Bug 143914 has been marked as a duplicate of this bug. ***
Comment 4 Darin Wright CLA 2006-05-30 09:25:46 EDT
*** Bug 144391 has been marked as a duplicate of this bug. ***
Comment 5 Darin Wright CLA 2007-03-12 12:27:28 EDT
*** Bug 174239 has been marked as a duplicate of this bug. ***
Comment 6 Mark A. Ziesemer CLA 2007-03-12 13:41:59 EDT
Any insight as to why this is resolved/later?  As I mentioned in my now duplicate report, this is essentially the inverse of bug 120676, which was fixed in the EnvironmentsManager.
Comment 7 Darin Wright CLA 2007-03-12 14:00:27 EDT
This may require API changes and is not a trivial fix. The execution envirnments/JRE infrastructure is not designed to handle JRE's that are not 'part' of the workspace yet. When a JRE is added on the JRE page, it is not committed to the workspace until the page's changes are applied. The EE page works on JREs that are visible to the workspace, not those that are being created/edited in the preferences.

It's not critical, and there is a simple workaround - press 'OK' on the JRE page and then re-open the pref dialog to the EE page.
Comment 8 Darin Wright CLA 2007-04-08 12:18:48 EDT
*** Bug 181456 has been marked as a duplicate of this bug. ***
Comment 9 Darin Wright CLA 2007-04-19 11:02:46 EDT
*** Bug 183205 has been marked as a duplicate of this bug. ***
Comment 10 Darin Wright CLA 2008-01-16 08:33:53 EST
*** Bug 215456 has been marked as a duplicate of this bug. ***
Comment 11 Darin Wright CLA 2008-01-16 08:34:49 EST
Re-opening, as this seems to be a common problem for users.
Comment 12 Darin Wright CLA 2008-05-02 13:31:04 EDT
Marking as 3.5 candidate
Comment 13 Markus Keller CLA 2008-09-04 11:57:31 EDT
(In reply to comment #7)
> The execution
> envirnments/JRE infrastructure is not designed to handle JRE's that are not
> 'part' of the workspace yet.

To fix bug 246239 in JDT/UI, we would also need access to these "working copy"
JREs, unless JavaRuntime.getDefaultVMInstall() returns the new setting
immediately.
Comment 14 Michael Rennie CLA 2008-09-04 12:13:48 EDT
I haven't looked into the code of the EE page yet, but I bet we could use preferences working copy manager to fix this: that way we could 'know' about uncommitted changes between the pages.
Comment 15 Darin Wright CLA 2009-02-04 11:47:25 EST
I removing this from the 3.5 plan. It would be nice to have this enhancement but we currently have no resources to work on the feature. Contributions would be accepted/reviewed.
Comment 16 Darin Wright CLA 2009-02-05 22:32:26 EST
*** Bug 263886 has been marked as a duplicate of this bug. ***
Comment 17 Markus Keller CLA 2009-02-06 06:03:08 EST
A simpler fix would be to just apply the changes when the user leaves the Installed JREs page, and reload the Execution Environments page each time it becomes visible.

That's how e.g. BuildPathsPropertyPage#setVisible(..) does it, see bug 32378 comment 21.
Comment 18 Markus Keller CLA 2009-02-06 06:31:53 EST
If there would be a way to only show the Apply button, but not Restore Defaults (bug 81202), then the user could at least do it manually without having to hunt for the Preferences dialog again.
Comment 19 Darin Wright CLA 2009-02-06 08:55:06 EST
(In reply to comment #17)
> A simpler fix would be to just apply the changes when the user leaves the
> Installed JREs page, and reload the Execution Environments page each time it
> becomes visible.

Applying changes can trigger builds and build paths (JRE containers) to be re-bound. If we perform apply when they leave the page, what happens if they eventually press cancel?
Comment 20 Dani Megert CLA 2009-02-06 09:01:00 EST
>If we perform apply when they leave the page, what happens if they
>eventually press cancel?
I think Markus meant that the user can press 'Apply'. At this point it doesn't matter what he does afterwards as it means to commit the current values.
Comment 21 Markus Keller CLA 2009-02-06 09:13:31 EST
The Windows UI guidelines say that Apply should store settings permanently,
even if the user cancels later. That's also what Eclipse does. Mac and GTK
guidelines would mandate to revert on Cancel, but we follow Windows in this
case.
Comment 22 Michael Rennie CLA 2009-06-16 09:29:32 EDT
*** Bug 280408 has been marked as a duplicate of this bug. ***
Comment 23 Curtis Windatt CLA 2010-07-07 14:37:26 EDT
*** Bug 319093 has been marked as a duplicate of this bug. ***
Comment 24 Dani Megert CLA 2011-07-19 02:30:24 EDT
*** Bug 352401 has been marked as a duplicate of this bug. ***
Comment 25 Sam Hanes CLA 2012-03-14 14:33:20 EDT
I think this is mostly a discoverability issue. It's not immediately obvious from the flow of the Installed JREs pane that the changes aren't committed until you commit the Preferences dialog. In many similar configuration tools where you make changes in a sub-dialog the changes are committed when you commit the sub-dialog. As Markus mentioned in comment 18, showing an enabled Accept button on the Installed JREs pane would provide a clear affordance that the changes haven't been committed.
Comment 26 Dani Megert CLA 2013-02-21 10:27:47 EST
*** Bug 401438 has been marked as a duplicate of this bug. ***
Comment 27 Mauro Molinari CLA 2013-07-08 10:45:49 EDT
Still a usability issue. If one knows of this problem it's ok, but if one doesn't he/she may be confused on how the Execution Environment preferences page works, since the newly added JREs are not shown.
Comment 28 Dani Megert CLA 2013-07-11 10:07:56 EDT
We should simply add the 'Apply' and the 'Restore Defaults' buttons i.e. remove noDefaultAndApplyButton() from JREsPreferencePage#createContents(Composite). While we get the apply behavior for free, the only thing to add is the restore behavior: simply remove all JREs and add the one used for launching the workspace.
Comment 29 Michael Rennie CLA 2013-07-11 10:21:01 EDT
(In reply to comment #28)
> We should simply add the 'Apply' and the 'Restore Defaults' buttons i.e.
> remove noDefaultAndApplyButton() from
> JREsPreferencePage#createContents(Composite). While we get the apply
> behavior for free, the only thing to add is the restore behavior: simply
> remove all JREs and add the one used for launching the workspace.

Funnily enough, Curtis and I were talking about this exact same thing yesterday, except that we thought 'Restore Defaults' should change the default JRE back to the original, rather than delete any JREs
Comment 30 Dani Megert CLA 2013-07-11 10:23:36 EDT
(In reply to comment #29)
> (In reply to comment #28)
> > We should simply add the 'Apply' and the 'Restore Defaults' buttons i.e.
> > remove noDefaultAndApplyButton() from
> > JREsPreferencePage#createContents(Composite). While we get the apply
> > behavior for free, the only thing to add is the restore behavior: simply
> > remove all JREs and add the one used for launching the workspace.
> 
> Funnily enough, Curtis and I were talking about this exact same thing
> yesterday, except that we thought 'Restore Defaults' should change the
> default JRE back to the original, rather than delete any JREs

No, it should delete the manually added ones. But, there's one thing we need to consider: JREs added via plug-in/product customization must also be added when restoring the defaults.
Comment 31 Dani Megert CLA 2013-07-11 10:25:54 EDT
(In reply to comment #30)
> (In reply to comment #29)
> > (In reply to comment #28)
> > > We should simply add the 'Apply' and the 'Restore Defaults' buttons i.e.
> > > remove noDefaultAndApplyButton() from
> > > JREsPreferencePage#createContents(Composite). While we get the apply
> > > behavior for free, the only thing to add is the restore behavior: simply
> > > remove all JREs and add the one used for launching the workspace.
> > 
> > Funnily enough, Curtis and I were talking about this exact same thing
> > yesterday, except that we thought 'Restore Defaults' should change the
> > default JRE back to the original, rather than delete any JREs
> 
> No, it should delete the manually added ones. But, there's one thing we need
> to consider: JREs added via plug-in/product customization must also be added
> when restoring the defaults.

Well, actually that does not work at all yet (see bug 241278).
Comment 32 Michael Rennie CLA 2013-07-11 12:27:54 EDT
(In reply to comment #30)

> No, it should delete the manually added ones. But, there's one thing we need
> to consider: JREs added via plug-in/product customization must also be added
> when restoring the defaults.

We have no way to easily know what was manually added, plus to be able to delete said JREs we would first have to save back to JavaRuntime (to flush the VM cache) which would cause mass re-binding (EEs) / building in the workspace prior to being able to ask JavaRuntime to recompute the system defaults. So I still maintain my position on not deleting anything.
Comment 33 Dani Megert CLA 2013-07-15 03:57:22 EDT
(In reply to comment #32)
> (In reply to comment #30)
> 
> > No, it should delete the manually added ones. But, there's one thing we need
> > to consider: JREs added via plug-in/product customization must also be added
> > when restoring the defaults.
> 
> We have no way to easily know what was manually added,

Yes, I know that. Just wanted to draw the picture here.

> plus to be able to
> delete said JREs we would first have to save back to JavaRuntime (to flush
> the VM cache) which would cause mass re-binding (EEs) / building in the
> workspace prior to being able to ask JavaRuntime to recompute the system
> defaults. So I still maintain my position on not deleting anything.

Restore Defaults should do the same as everywhere i.e. it must look like starting a fresh workspace. Note that the user first sees the change and it would only be applied when he presses Apply or OK. So, give the user what he asked for.
Comment 34 Michael Rennie CLA 2013-07-17 12:58:16 EDT
(In reply to comment #33)
> (In reply to comment #32)

> Restore Defaults should do the same as everywhere i.e. it must look like
> starting a fresh workspace. Note that the user first sees the change and it
> would only be applied when he presses Apply or OK. So, give the user what he
> asked for.

I could probably make this work. I'll take a swing at it for M2.
Comment 35 Martin Mathew CLA 2013-10-21 23:40:10 EDT
*** Bug 419993 has been marked as a duplicate of this bug. ***
Comment 36 Sarika Sinha CLA 2014-03-21 07:14:18 EDT
Can't we have something similar to what we do when leaving the Java Build Path Preference Page ? So that user knows before leaving the page that he should Apply or Discard the Changes ?
Comment 37 Michael Rennie CLA 2014-03-21 09:59:09 EDT
(In reply to Sarika Sinha from comment #36)
> Can't we have something similar to what we do when leaving the Java Build
> Path Preference Page ? So that user knows before leaving the page that he
> should Apply or Discard the Changes ?

We definitely could. We could also just add our own apply button so we don't have to deal with the defaults button - leave the noDefaultAndApplyButton() and just create our own button.
Comment 38 Sarika Sinha CLA 2014-11-11 03:32:08 EST
Created attachment 248562 [details]
Addition of only Apply button in Preference Page
Comment 39 Sarika Sinha CLA 2014-11-11 03:33:43 EST
Created attachment 248563 [details]
Debug patch to support Apply in JREs Preference page
Comment 40 Sarika Sinha CLA 2014-11-11 03:34:41 EST
Created attachment 248564 [details]
UI patch to support Apply in Build Path Preference page
Comment 41 Sarika Sinha CLA 2014-11-11 03:38:24 EST
Enhanced  Preference Page to support addition of only Apply button (without Default button). Have added Apply button in "Installed JREs" and "Build Path" Preference pages. Have also added a warning message to be displayed to show unsaved on moving out of "Installed JREs" page without applying the changes.
Comment 42 Michael Rennie CLA 2014-11-13 13:49:35 EST
(In reply to Sarika Sinha from comment #41)
> Enhanced  Preference Page to support addition of only Apply button (without
> Default button). Have added Apply button in "Installed JREs" and "Build
> Path" Preference pages. Have also added a warning message to be displayed to
> show unsaved on moving out of "Installed JREs" page without applying the
> changes.

1. Rather than add new API to PreferencePage, could you not just contribute our own apply button using org.eclipse.jface.preference.PreferencePage.contributeButtons(Composite)?

2. In InstalledJREsBlock could you not get rid of all the timestamp code and simply set a boolean when changes to the backing list of vms is made (to determine dirty state)? That way the dirty state uses the same logic we use to actually update the VMs when you close the page.

3. the warning string is a bit wordy, couldn't 

'The Installed JREs property page contains unsaved modifications. Do you want to save changes so that other Installed JREs related property pages can be updated?' 

be simplified to something like:

'The page contains unsaved JRE modifications.'
Comment 43 Dani Megert CLA 2014-11-20 08:37:51 EST
Comment on attachment 248564 [details]
UI patch to support Apply in Build Path Preference page

I would use the same naming for the new API as already used to hide the Apply and Default button ==> #noDefaultButton().

To make the code more readable I'd replace 'createDefaultAndApplyButton' with 'createApplyButton' and 'createDefaultButton', and adapt the code accordingly. This will also make the button creation code more readable.

Please remove all unrelated whitespace changes.
Comment 44 Dani Megert CLA 2014-11-20 08:41:02 EST
(In reply to Michael Rennie from comment #42)
> (In reply to Sarika Sinha from comment #41)
> > Enhanced  Preference Page to support addition of only Apply button (without
> > Default button). Have added Apply button in "Installed JREs" and "Build
> > Path" Preference pages. Have also added a warning message to be displayed to
> > show unsaved on moving out of "Installed JREs" page without applying the
> > changes.
> 
> 1. Rather than add new API to PreferencePage, could you not just contribute
> our own apply button using
> org.eclipse.jface.preference.PreferencePage.contributeButtons(Composite)?
 
No, that would be wrong: There is already API to hide both buttons, so, adding API to only hide one of them makes sense. Also, first asking not to create the 'Apply' button and then add it in the client code isn't really a good idea ;-).
Comment 45 Dani Megert CLA 2014-11-24 10:29:35 EST
(In reply to Michael Rennie from comment #42)
> 2. In InstalledJREsBlock could you not get rid of all the timestamp code and
> simply set a boolean when changes to the backing list of vms is made (to
> determine dirty state)? That way the dirty state uses the same logic we use
> to actually update the VMs when you close the page.

I'm fine either way here. We successfully use the time stamp in the other case, so, using it here would be OK for me.

 
> 3. the warning string is a bit wordy, couldn't 
We should use the same wording for both cases. More is better here, I think. Sarika, what do you think?


One thing I noticed is that clicking the [x] in the dialog leaves us on the new preference/property page. I would expect to stay on the previous page, since it is not clear which action we took.
Comment 46 Sarika Sinha CLA 2014-11-25 02:29:34 EST
(In reply to Dani Megert from comment #45)
> 
> One thing I noticed is that clicking the [x] in the dialog leaves us on the
> new preference/property page. I would expect to stay on the previous page,
> since it is not clear which action we took.

Same thing happens for Java Build Path. We should change for both or let it remain as it is now.
Comment 47 Sarika Sinha CLA 2014-11-25 03:56:57 EST
How about having warning string like :

'This page contains unsaved modifications. Do you want to save changes so that other related pages can be updated?'
Comment 48 Sarika Sinha CLA 2014-11-25 04:05:50 EST
Created attachment 248892 [details]
Addition of only Apply button in Preference Page
Comment 49 Sarika Sinha CLA 2014-11-25 04:06:29 EST
Created attachment 248893 [details]
Debug patch to support Apply in JREs Preference page
Comment 50 Sarika Sinha CLA 2014-11-25 04:07:39 EST
Created attachment 248894 [details]
UI patch to support Apply in Build Path Preference page
Comment 51 Dani Megert CLA 2014-12-02 09:02:52 EST
Comment on attachment 248892 [details]
Addition of only Apply button in Preference Page

The Javadoc of all new members is wrong.
Comment 52 Dani Megert CLA 2014-12-02 09:09:31 EST
(In reply to Sarika Sinha from comment #47)
> How about having warning string like :
> 
> 'This page contains unsaved modifications. Do you want to save changes so
> that other related pages can be updated?'

I would make the connection to the 'Apply' button ==>

This page contains unsaved modifications. Do you want to apply the changes so that other related pages can be updated?
Comment 53 Dani Megert CLA 2014-12-02 09:17:21 EST
(In reply to Dani Megert from comment #52)
> (In reply to Sarika Sinha from comment #47)
> > How about having warning string like :
> > 
> > 'This page contains unsaved modifications. Do you want to save changes so
> > that other related pages can be updated?'
> 
> I would make the connection to the 'Apply' button ==>
> 
> This page contains unsaved modifications. Do you want to apply the changes
> so that other related pages can be updated?

Actually, this is not working, because at the time we show the dialog, the page is already the new one. Hence "this page" is not enough and we need to have the name of the old page in the message and the title.
Comment 54 Dani Megert CLA 2014-12-02 09:18:20 EST
(In reply to Sarika Sinha from comment #46)
> (In reply to Dani Megert from comment #45)
> > 
> > One thing I noticed is that clicking the [x] in the dialog leaves us on the
> > new preference/property page. I would expect to stay on the previous page,
> > since it is not clear which action we took.
> 
> Same thing happens for Java Build Path. We should change for both or let it
> remain as it is now.

Let's leave this as is for now.
Comment 55 Sarika Sinha CLA 2014-12-03 04:39:05 EST
Created attachment 249124 [details]
Warning Dialog
Comment 56 Sarika Sinha CLA 2014-12-03 04:42:26 EST
(In reply to Dani Megert from comment #53)
> (In reply to Dani Megert from comment #52)
> > (In reply to Sarika Sinha from comment #47)
> > > How about having warning string like :
> > > 
> > > 'This page contains unsaved modifications. Do you want to save changes so
> > > that other related pages can be updated?'
> > 
> > I would make the connection to the 'Apply' button ==>
> > 
> > This page contains unsaved modifications. Do you want to apply the changes
> > so that other related pages can be updated?
> 
> Actually, this is not working, because at the time we show the dialog, the
> page is already the new one. Hence "this page" is not enough and we need to
> have the name of the old page in the message and the title.

Attached the screenshot of dialog, it stays in Installed JREs Page and the dialog heading also mentions the same.
Comment 57 Dani Megert CLA 2014-12-03 04:51:40 EST
(In reply to Sarika Sinha from comment #56)
> (In reply to Dani Megert from comment #53)
> > (In reply to Dani Megert from comment #52)
> > > (In reply to Sarika Sinha from comment #47)
> > > > How about having warning string like :
> > > > 
> > > > 'This page contains unsaved modifications. Do you want to save changes so
> > > > that other related pages can be updated?'
> > > 
> > > I would make the connection to the 'Apply' button ==>
> > > 
> > > This page contains unsaved modifications. Do you want to apply the changes
> > > so that other related pages can be updated?
> > 
> > Actually, this is not working, because at the time we show the dialog, the
> > page is already the new one. Hence "this page" is not enough and we need to
> > have the name of the old page in the message and the title.
> 
> Attached the screenshot of dialog, it stays in Installed JREs Page and the
> dialog heading also mentions the same.


Looks good! My workspace must have been in a strange state. When testing I saw this:
> > when we show the dialog, the page is already the new one.
Testing today, I see the same as you: the dialog is shown on top of the page we want to leave.
Comment 58 Sarika Sinha CLA 2014-12-03 05:21:31 EST
Created attachment 249125 [details]
Addition of only Apply button in Preference Page
Comment 59 Sarika Sinha CLA 2014-12-03 05:22:01 EST
Created attachment 249126 [details]
Debug patch to support Apply in JREs Preference page
Comment 60 Sarika Sinha CLA 2014-12-03 05:26:07 EST
Created attachment 249127 [details]
UI patch to support Apply in Build Path Preference page

Updated Java Doc and changed to "Apply" in dialog message.
Comment 61 Dani Megert CLA 2014-12-08 06:33:42 EST
Comment on attachment 249125 [details]
Addition of only Apply button in Preference Page

The Javadoc for createApplyButton is still wrong.

We should avoid the code duplication of the Apply button creation. I would expect something like this:

if (createDefaultButton) {
    create Default button code
}
if (createApplyButton) {
    create Apply button code
}
Comment 62 Sarika Sinha CLA 2014-12-09 06:32:10 EST
Created attachment 249277 [details]
UI patch to support Apply in Build Path Preference page Approach 1
Comment 63 Sarika Sinha CLA 2014-12-09 06:33:08 EST
Created attachment 249279 [details]
UI patch to support Apply in Build Path Preference page Approach 2

Added 2 approaches to remove duplicate code in PreferencePage
Comment 64 Dani Megert CLA 2014-12-15 09:35:52 EST
(In reply to Sarika Sinha from comment #62)
> Created attachment 249277 [details] [diff]
> UI patch to support Apply in Build Path Preference page Approach 1

This is fine but you must not reuse the same GridData data instance. Also, the column size can be expressed easier:
layout.numColumns = 1 + (createApplyButton && createDefaultButton ? 1 : 0);


(In reply to Sarika Sinha from comment #63)
> Created attachment 249279 [details] [diff]
> UI patch to support Apply in Build Path Preference page Approach 2
> 
> Added 2 approaches to remove duplicate code in PreferencePage

#applyDialogFont should not be part of #createApplyButton.

This approach still has code duplication and will fail if we introduce noApplyButton() at some point. Therefore we will go with approach 1. Please update the patch for approach 1 with my comments and then we're ready to go with that change.
Comment 65 Sarika Sinha CLA 2014-12-16 06:01:04 EST
Created attachment 249458 [details]
UI patch to only show 'Apply' button in PreferencePage Approach 1

Updated Approach 1 patch accordingly.
Comment 66 Dani Megert CLA 2014-12-16 08:45:08 EST
(In reply to Sarika Sinha from comment #65)
> Created attachment 249458 [details] [diff]
> UI patch to support Apply in Build Path Preference page Approach 1
> 
> Updated Approach 1 patch accordingly.

Committed via bug 81202.
Comment 67 Dani Megert CLA 2014-12-16 09:07:00 EST
Comment on attachment 249126 [details]
Debug patch to support Apply in JREs Preference page

#getEncodedSettings
The name is misleading. Usually we use "settings" for dialog settings. I would rename this to #getEncodedVMInstalls. The code to write out the default VM is redundant to the code that writes the attributes. Simply mark the default VM when encoding all the VMs. In the loop add:

	if (elem == vmInstall) {
		// marks as default;
	}

#initializeTimeStamp does not need to be protected

#okToLeave should use the wording "apply" not "save" in the comments

With those changes the patch is good to go.
Comment 68 Dani Megert CLA 2014-12-16 09:47:05 EST
(In reply to Dani Megert from comment #67)
> With those changes the patch is good to go.

Actually there's a small issue when the 'Execution Environment' page already has a selection:
- select an entry
- go to the JRE page
- add or remove a JRE
- switch to the EE page and apply
==> the EE page shows old content

The same problem happens when going from JRE to Compiler preference page: the warning/status is only updated when the Compiler page hasn't been shown before.
Comment 69 Sarika Sinha CLA 2014-12-18 02:29:55 EST
(In reply to Dani Megert from comment #68)
> (In reply to Dani Megert from comment #67)
> > With those changes the patch is good to go.
> 
> Actually there's a small issue when the 'Execution Environment' page already
> has a selection:
> - select an entry
> - go to the JRE page
> - add or remove a JRE
> - switch to the EE page and apply
> ==> the EE page shows old content
> 
> The same problem happens when going from JRE to Compiler preference page:
> the warning/status is only updated when the Compiler page hasn't been shown
> before.

Created Bug 455556 for this. Will need the support from Platform UI to make this work in EE and Compiler page.
Comment 70 Sarika Sinha CLA 2014-12-18 02:50:43 EST
Created attachment 249512 [details]
Debug patch to support Apply in JREs Preference page

Review comments incorporated !!
Comment 71 Dani Megert CLA 2014-12-19 07:51:51 EST
(In reply to Sarika Sinha from comment #70)
> Created attachment 249512 [details] [diff]
> Debug patch to support Apply in JREs Preference page
> 
> Review comments incorporated !!

#initializeTimeStamp is now opened it up even more. I've fixed that before committing your latest patch.

Committed with http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=2ef686649486e20d93522f435f6d4c4c66fa1cb9

I've also removed the superfluous semicolon that gave a compile warning.
Comment 72 Dani Megert CLA 2014-12-19 07:54:20 EST
As long as bug is not fixed, this bug here can't be marked fixed.
Comment 73 Dani Megert CLA 2014-12-19 08:02:31 EST
(In reply to Sarika Sinha from comment #69)
> Created Bug 455556 for this. Will need the support from Platform UI to make
> this work in EE and Compiler page.

I don't think so. What we need to do is recompute the page based on the applied state. This can be done when setVisible(visible) is called with visible == true.
Comment 74 Sarika Sinha CLA 2015-01-05 00:40:12 EST
Fixed EE refresh page issue via
http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=d3f82f52c5976cec08019bc7682ff3c1afd4bf44

For Compliance page, need to discuss with JDT UI team as we already have the required code but checks for (fProject != null) before updating Compliance warning.
Comment 75 Markus Keller CLA 2015-01-13 08:00:20 EST
(In reply to Sarika Sinha from comment #74)
> For Compliance page, need to discuss with JDT UI team as we already have the
> required code but checks for (fProject != null) before updating Compliance
> warning.

Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=8953803ece6cec9545d597ff037c58328791bc89
Comment 76 Dani Megert CLA 2015-01-13 09:45:04 EST
Sarika, please verify that this now works as expected.
Comment 77 Sarika Sinha CLA 2015-01-19 04:20:00 EST
Verified using
Eclipse SDK

Version: Mars (4.5)
Build id: I20150116-1000