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

Bug 369819

Summary: Context menu not available if server is empty
Product: [WebTools] WTP ServerTools Reporter: Kaloyan Raev <kaloyan>
Component: wst.serverAssignee: Steven Hung <sghung>
Status: RESOLVED FIXED QA Contact: Elson Yuen <eyuen7>
Severity: critical    
Priority: P3 CC: cbridgha, neil.hauge, remy.suen
Version: 3.3Flags: eyuen7: pmc_approved? (david_williams)
eyuen7: pmc_approved? (raghunathan.srinivasan)
eyuen7: pmc_approved? (naci.dai)
eyuen7: pmc_approved? (deboer)
neil.hauge: pmc_approved+
kaloyan: pmc_approved+
eyuen7: pmc_approved? (cbridgha)
Target Milestone: 3.3.2   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/109095
Whiteboard: PMC_Approved
Bug Depends on:    
Bug Blocks: 370894    
Attachments:
Description Flags
Patch v1.0
none
Patch v1.1 eyuen7: iplog+

Description Kaloyan Raev CLA 2012-01-26 11:00:37 EST
Steps to reproduce:
1. Start Eclipse in empty workspace. 
2. Open the Servers view. 
3. Try to right-click in the Servers view and call New > Server.

Problem: the context menu does not appear in step 3. 

This is due to bug 365278 which I personally approved to go into 3.3.2 :) 

I mark this bug as critical, because I consider it as a behavioral regression in compare to 3.3.1 and it would be nice to fix it before releasing it with 3.3.2. This bug might not only break user experience for those users how are used to create their first server via the context menu, but might also break existing adopter's SWTBot tests that rely on this behavior.
Comment 1 Elson Yuen CLA 2012-01-26 14:16:48 EST
With bug 365278, the user can create the new server by clicking on the link directly.  Are you proposing to have the pop up menu as well even with that new link to achieve the same server creation action?
Comment 2 Kaloyan Raev CLA 2012-01-26 14:29:45 EST
Yes, I would like to have the popup menu too. 

That change was an improvement targeting newbie users who don't know what to do when seeing the empty Servers view. But for experienced users this is a regression, because now they have to change their habits - instead of right-clicking anywhere on the Servers view, now they are forced to click exactly on this link (which is much smaller than the area of the Servers view). 

And this can also affect adopters who are relying on the old behavior - in their automated tests or "step-by-step" user documentation.
Comment 3 Steven Hung CLA 2012-02-07 16:39:54 EST
Created attachment 210695 [details]
Patch v1.0

1. 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. 
Due to bugzilla 365278, the behaviour has changed and causes regressions, since it can affect automated tests and "step-by-step" user documentation, which relies on the context menu being accessible when no servers exist in the server view.

2. Is there a work-around? If so, why do you believe the work-around is insufficient? 
No, there is no workaround.

3. How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
The fix has been tested, the test cases are listed in the comments. There is no JUnit test added because it is an addition of a context menu.

4. Give a brief technical overview. Who has reviewed this fix? 
The context menu in the server view is added in the case where no servers exist in the server view and it is displaying the empty server default message.

5. What is the risk associated with this fix? 
Low risk, it is setting a context menu on the new page only.


Overview of fix:
A context menu needs to be set for the view containing the empty server default message. The context that is set must be the same context menu that is launched via the CommonNavigator. The default message page needs to call org.eclipse.wst.server.ui.internal.cnf.ServerActionProvider.fillContextMenu(IMenuManager), which I have verified during testing.

The empty server default message page needs to have the context menu set in two places: the white space and the text link. If it isn't set in both places, the context menu cannot be loaded in the entire view. In particular, if the user is launching the context menu while over the empty server text.

Tests run:
1. No server exists, ensure right clicking on the white space of the view loads the new server wizard
2. No server exists, ensure shift + f10 will load the new server wizard (keyboard accessibility test)
3. No server exists, ensure clicking Enter will load the new server wizard 
4. No server exists, ensure right clicking on the empty server text loads the new server wizard
5. Create a new HTTP Preview server through the context menu, do it three times to ensure the context menu loads successfully
6. Delete the HTTP Preview servers from test #5, to ensure the empty server default message page shows and the context menu item still shows
Comment 4 Steven Hung CLA 2012-02-07 16:56:44 EST
Created attachment 210696 [details]
Patch v1.1

Added additional error checking in org.eclipse.wst.server.ui.internal.cnf.ServersView2.deferredInitialize() to patch 1.0.

The same test cases were run again.

In addition, here is an update to the PMC candidate answer #4, which I had forgotten to mention who had reviewed it:

4. Give a brief technical overview. Who has reviewed this fix? 
The context menu in the server view is added in the case where no servers exist
in the server view and it is displaying the empty server default message. The fix was reviewed by Elson Yuen.
Comment 5 Elson Yuen CLA 2012-02-07 17:04:19 EST
Steven, thanks for providing the patch.  The changes looks good and test coverage is sufficient as well. Given that this problem is a change in behaviour introduced by a recent bug 365278 that may causes existing automated test in the field to fail, I am marking this for PMC approval to maintain the consistency of the product.
Comment 6 Elson Yuen CLA 2012-02-08 13:53:20 EST
Code released to 33M and HEAD
Comment 7 Elson Yuen CLA 2012-02-08 14:17:49 EST
*** Bug 369554 has been marked as a duplicate of this bug. ***
Comment 8 Kaloyan Raev CLA 2012-02-14 02:39:06 EST
Is this patch included in Indigo SR2? I am currently testing the Indigo SR2 RC3 build of the JEE distro and there is no context menu in the empty Servers view.
Comment 9 Eclipse Genie CLA 2017-10-11 16:37:52 EDT
New Gerrit change created: https://git.eclipse.org/r/109095