Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371060 - [hotbug] "Create a new local server" checkbox disappears
Summary: [hotbug] "Create a new local server" checkbox disappears
Status: RESOLVED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Elson Yuen CLA
QA Contact: Elson Yuen CLA
URL:
Whiteboard: PMC
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 06:05 EST by Kaloyan Raev CLA
Modified: 2017-10-11 16:38 EDT (History)
2 users (show)

See Also:
eyuen7: pmc_approved? (david_williams)
eyuen7: pmc_approved? (raghunathan.srinivasan)
eyuen7: pmc_approved? (naci.dai)
eyuen7: pmc_approved? (deboer)
neil.hauge: pmc_approved+
eyuen7: pmc_approved? (kaloyan)
cbridgha: pmc_approved+


Attachments
patch (1.19 KB, patch)
2012-02-09 06:05 EST, Kaloyan Raev CLA
no flags Details | Diff
v1.0 (1.83 KB, patch)
2012-02-09 15:04 EST, Elson Yuen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kaloyan Raev CLA 2012-02-09 06:05:55 EST
Created attachment 210788 [details]
patch

We are building a server adapter that defines the one runtime type and two server types attached to it. 

If I go to Window > Preferences > Runtime Environments > Add then the New Server Runtime Environment wizard pops up. Our runtime type is preselected and the "Create a new local server" checkbox is visible. If I click on the checkbox it disappears. The same happens if I change the selection. The checkbox does not appear again for this runtime type. 

After some debugging in the code I found out the the current logic in the WTP Server Framework is to show the checkbox only if the selected runtime type has only one server type attached. In the case of our runtime which has two server types, the checkbox should not appear. 

I found the root cause to be in the RuntimeTypeComposite.setVisible() method. There a call for setting the initial selection is done, which calls the NewRuntimeComposite.handleServer() method which controls the visibility of the checkbox. For some reason this does not work properly if this call chain is done synchronously. If the setVisible() method sets the initial selection asynchronously everything works as expected. 

I am attaching a patch that solves the issue.
Comment 1 Kaloyan Raev CLA 2012-02-09 06:11:12 EST
I would like to raise this as a hotbug for Indigo SR2. 

The bug is not a major one for the community as a whole, but it affects an adopter's product of SAP in a negative way. We have some reports from users who are confused by this behavior and have the impression that our product is fragile. 

It's very likely that this issue exists for years. However, we are building a server adapter with two server types for one runtime for the first time. This is why we haven't noticed this issue before. 

The patch attached should be very safe and we hope it can go into the RC phase of Indigo SR2.
Comment 2 Elson Yuen CLA 2012-02-09 15:04:20 EST
Created attachment 210820 [details]
v1.0

This new patch is based on the original patch with handle cases like widget is disposed scenarios properly.
Comment 3 Elson Yuen CLA 2012-02-09 15:18:30 EST
    * Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 
It is a hotbug requested by adopter since it causes confusion to the adopter's product. The checkbox may disappear upon clicking.

    * Is there a work-around? If so, why do you believe the work-around is insufficient? 
In the specific scenario, the user will click on the checkbox and the checkbox will disappear. The user can ignore that and no workaround is required.  However, there is no workaround that allow the adopter to no show the checkbox in the first place.

    * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
No JUnit has been added since it is specific to the adopter's scenario.  I have tested the tomcat case.

    * Give a brief technical overview. Who has reviewed this fix? 
The problem is caused by the NewRuntimeComposite.setVisible() method call is sometimes getting called on a non-UI thread as a result of the initial defualt selection.  The fix is to wrap the initial selection code by getDisplay().asyncExec.  Elson has review the fix.

    * What is the risk associated with this fix?
The risk on this change is fairly low as there is no change in the actual design of the runtime creation wizard.
Comment 4 Chuck Bridgham CLA 2012-02-10 14:34:45 EST
This has my vote after Elson's vote - and respin of the patch
Comment 5 Elson Yuen CLA 2012-02-10 15:15:55 EST
Code released to 33M and HEAD.
Comment 6 Eclipse Genie CLA 2017-10-11 16:38:00 EDT
New Gerrit change created: https://git.eclipse.org/r/109096