Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328311

Summary: RuntimePreferencePage does not update if new runtimes are added
Product: [WebTools] WTP ServerTools Reporter: Rob Stryker <stryker>
Component: wst.serverAssignee: Elson Yuen <eyuen7>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2.4   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/109027
Whiteboard:
Attachments:
Description Flags
Adds a runtime lifecycle listener to the page
none
Adds lifecycle listener, display.async executes hte update
none
v1.0 none

Description Rob Stryker CLA 2010-10-21 01:32:16 EDT
If some background task adds a runtime, or some other preference page adds a runtime, the table viewer in the RuntimePreferencePage does not update with the new runtimes. Once the composite has been created, it only responds to the buttons on its own page, rather than a generic listener. 

I have a patch which seems to work with no ill effect that I can tell after adding and removing various runtimes.
Comment 1 Rob Stryker CLA 2010-10-21 01:39:25 EDT
Created attachment 181356 [details]
Adds a runtime lifecycle listener to the page

Patch above, fairly simple.
Comment 2 Rob Stryker CLA 2010-10-21 01:39:50 EDT
I'd like to see this in 3.2.3 release if its possible.
Comment 3 Rob Stryker CLA 2010-10-21 01:55:19 EDT
Created attachment 181357 [details]
Adds lifecycle listener, display.async executes hte update

Previously forgot that the events might come in on other threads.
Comment 4 Angel Vera CLA 2010-10-21 10:14:25 EDT
I am working on the plan for 3.2.3 right now. It sounds that you did some testing already. Is it possible to identify in bullets the scenarios that you tested? that will give me more confidence on the patch and save time on me reviewing the code.
Comment 5 Rob Stryker CLA 2010-10-22 05:48:46 EDT
1) create new preference page with buttons which can add / remove runtimes
2) add a runtime on new page, switch to official pref page, observe runtime was added
3) remove a runtime on new page, switch to official pref page, observe runtime was removed
4) rename a runtime, save it, switch to official pref page, observe runtime was updated

Even if you did a code-review here, it's a pretty small patch and should not take long. I basically made the RuntimeComposite field a member field, added the page as a lifecycle listener during creation, removed it during dispose(), and respond to lifecycle events by refreshing the composite / viewer.
Comment 6 Rob Stryker CLA 2011-02-03 14:17:25 EST
Any reason why you couldn't squeeze in fixing a bug with an easy to understand pre-made and contributed patch which sat on the bug for three months?
Comment 7 Angel Vera CLA 2011-02-04 11:03:26 EST
Rob, It was a matter of priorities and impact to the product.
Comment 8 Elson Yuen CLA 2011-03-10 15:24:41 EST
Created attachment 190921 [details]
v1.0

Updated the patch with adding missing method on the previous patch.
Comment 9 Elson Yuen CLA 2011-03-10 15:25:59 EST
Changes released to 32M.
Comment 10 Elson Yuen CLA 2011-03-10 15:27:19 EST
Tested the scenario on a runtime has been added when the Runtime Enviornment preference page is already up and running.  The newly added runtime gets refreshed on the table properly.
Comment 11 Elson Yuen CLA 2011-03-11 17:09:43 EST
Changes released to 33M
Comment 12 Angel Vera CLA 2011-03-15 10:39:54 EDT
Elson, I am reopening this bug to ensure that we do a proper check that the bug is fixed in 324. 

I know this one had some problems integrating it with our builds because it was during smoke test time. Can you please double check that your changes made it into 324, if not then please re-release. It might also worth checking the 3.3 builds
Comment 13 Elson Yuen CLA 2011-03-24 17:39:29 EDT
I only marked this defect has been resolved after resolving the build integration issue.  Therefore, the changes are released on both 32M and 33M.
Comment 14 Eclipse Genie CLA 2017-10-11 16:35:55 EDT
New Gerrit change created: https://git.eclipse.org/r/109027