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

Bug 367460

Summary: ServerEditorSection has no ability to take alternative action on doSave(etc)
Product: [WebTools] WTP ServerTools Reporter: Rob Stryker <stryker>
Component: wst.serverAssignee: Elson Yuen <eyuen7>
Status: RESOLVED FIXED QA Contact: Elson Yuen <eyuen7>
Severity: enhancement    
Priority: P3    
Version: 3.3   
Target Milestone: 3.3.2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/109087
https://git.eclipse.org/r/109085
Whiteboard:
Attachments:
Description Flags
A patch adding the required API
eyuen7: iplog+
v1.0 none

Description Rob Stryker CLA 2011-12-22 16:26:30 EST
Very related to:  https://bugs.eclipse.org/bugs/show_bug.cgi?id=286699

The server editor can have multiple pages. Bug 286699 addresses new pages. However, I've added a ServerEditorSection on the first page, OverviewEditorPart.  However, OverviewEditorPart.doSave(), or ServerEditorPart.doSave() does not call doSave() on the children sections. In fact, the children sections have no doSave() api at all. 

I recognize the idea here is that we should only be editing objects in the
IServerWorkingCopy and so the sections themselves shouldn't need to save anything,
however our editor would like to keep some data in external models, for example, eclipse secure storage. Being limited here to only adding data to the IServerWorkingCopy is hard to deal with. 

A workaround is to add an additional page, and add this section to a ServerEditorPart which is not OverviewEditorPart. Then, my custom page can take whatever actions it wants.  While this workaround is effective, it is very limiting in that it forces our UI to change because of a limitation on the first page.
Comment 1 Rob Stryker CLA 2011-12-22 16:28:34 EST
Created attachment 208755 [details]
A patch adding the required API

I hope this patch is safe and uncontroversial enough that we can maybe push this into a release without too much delay.
Comment 2 Rob Stryker CLA 2011-12-22 16:42:18 EST
The only possible dangers I see here is if one of the sections do not properly catch all exceptions, and somehow throw a RuntimeException. This could potentially blow up the stack during a doSave... however I would see this more as a coding error in the ServerEditorSection that decides to make use of this new functionality. 

So long as all overriders of the method properly catch and handle all exceptions, this should work fine.
Comment 3 Elson Yuen CLA 2011-12-23 14:19:48 EST
Created attachment 208785 [details]
v1.0

The logic looks good. The updated patch is based on the original submitted patch with some code cleanup and provide the default implementation to increment the progress monitor properly even if the adopter decided not to overwrite the doSave() method.
Comment 4 Elson Yuen CLA 2011-12-23 14:20:43 EST
Code released to 32M and HEAD
Comment 5 Eclipse Genie CLA 2017-10-11 16:37:35 EDT
New Gerrit change created: https://git.eclipse.org/r/109087
Comment 6 Eclipse Genie CLA 2017-10-11 16:37:37 EDT
New Gerrit change created: https://git.eclipse.org/r/109085