Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368503 - ModifyModulesComposite cannot block removal of modules
Summary: ModifyModulesComposite cannot block removal of modules
Status: RESOLVED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Elson Yuen CLA
QA Contact: Elson Yuen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 369708
  Show dependency tree
 
Reported: 2012-01-12 23:07 EST by Rob Stryker CLA
Modified: 2017-10-11 16:37 EDT (History)
0 users

See Also:


Attachments
Fixes the described issue (2.51 KB, patch)
2012-01-12 23:10 EST, Rob Stryker CLA
eyuen7: iplog+
Details | Diff
v1.0 (2.83 KB, patch)
2012-01-25 11:56 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 Rob Stryker CLA 2012-01-12 23:07:52 EST
The ModifyModulesComposite class automatically checks if addition of a module to a server can proceed. If it cannot (if canModifyModules returns false) it puts up an error preventing the addition of the module to the right side of the wizard. 

It does not perform this check on removal of modules. If canModifyModules(null, selectedRemoval) would return an error status, the composite never checks it and so does not block the removal. 

The result is that a user thinks they can remove the module. Upon pressing 'finish', the removal cannot proceed, and an error message comes up. 

It would be much better if the composite checks this itself, as it does for additions.
Comment 1 Rob Stryker CLA 2012-01-12 23:10:39 EST
Created attachment 209425 [details]
Fixes the described issue
Comment 2 Elson Yuen CLA 2012-01-25 11:56:35 EST
Created attachment 210065 [details]
v1.0

Thanks for submitting the patch.  In org.eclipse.wst.server.ui.internal.wizard.page.ModifyModulesComposite.setEnablement(), the break at the bottom should not be called to prevent premature setting on the enablement based on one single module pass:
						if (requiredModules.length == 1 && requiredModules[0].equals(module)) {
							// this is a required module and can't be removed, exit the loop
							wizard.setMessage(NLS.bind(Messages.wizModuleRequiredModule, module.getName()), IMessageProvider.ERROR);
							enabled = false;
							break;
						}
						enabled = true;
						break;

The updated patch is based on the original patch with this problem fixed and some clean up).
Comment 3 Elson Yuen CLA 2012-01-25 12:05:26 EST
Code released to 33M and HEAD.
Comment 4 Eclipse Genie CLA 2017-10-11 16:37:43 EDT
New Gerrit change created: https://git.eclipse.org/r/109090