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

Bug 324959

Summary: Terminate and Remove doesn't always terminate (but always removes)
Product: [Eclipse Project] Platform Reporter: Michael Dillon <michael.dillon>
Component: DebugAssignee: Pawel Piech <pawel.1.piech>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: Michael_Rennie, pawel.1.piech, teodor.madan
Version: 3.7Flags: Michael_Rennie: review+
Target Milestone: 3.8 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix (not used).
teodor.madan: iplog-
Fix to disable. pawel.1.piech: iplog-

Description Michael Dillon CLA 2010-09-10 08:41:13 EDT
Build Identifier: 20100617-1415

When selecting multiple running processes, the terminate and remove option in the debug view terminates the running processes and removes them from the view as expected.
However, when one of the selected processes is already stopped, the running processes are simply removed - leaving the processes running disconnected.

Reproducible: Always

Steps to Reproduce:
1. Launch two or more processes
2. From the debug view, stop one of the processes (but don't remove it)
3. Again in the debug view, select all of the processes (including the stopped one), and select "terminate and remove".
Comment 1 Teodor Madan CLA 2011-09-05 03:53:58 EDT
Created attachment 202738 [details]
Fix (not used).

Update TerminateCommand to report it is executable if at least one selected target can be terminated.
Comment 2 Teodor Madan CLA 2011-09-05 03:54:48 EDT
It is a debug platform issue. It can be reproduced on CDT as well.
Comment 3 Pawel Piech CLA 2011-09-06 15:05:29 EDT
(In reply to comment #1)
> Created attachment 202738 [details]
> Fix
> 
> Update TerminateCommand to report it is executable if at least one selected
> target can be terminated.

There's a couple possible solutions to this, all of them have some drawbacks:

1) The solution proposed in patch changes the behavior of the standard terminate action, such that if multiple elements are selected, the terminate action will be enabled if ANY of the elements can be terminated.  The current action enablement is to enable only if all selected elements can be terminated.

2) For the Terminate and Remove action, call the ITerminateHandler.execute() even if ITerminateHandler.canExecute() returns false.  The swallow the error if one comes back.  This will allow the handler to terminate some of the selected elements, but without changing the behavior of the terminate handler.  The down-side is that terminate and remove may suppress other valid errors that would be shown to the user upon Terminate and Remove.

I personally don't like either option, but we'd need to create an "ITerminateHandler2" interface to get the ideal behavior, which seems like an overkill for this minor bug.  So I guess I'd recommend going with option 1 and Teodor's patch.  Any objections?
Comment 4 Pawel Piech CLA 2011-09-06 15:10:22 EDT
Another (simpler) option would be to just disable terminate and remove if any of the selected launches are not terminated but terminate is disabled... This seems like the most correct solution.
Comment 5 Michael Rennie CLA 2011-09-06 15:14:01 EDT
(In reply to comment #4)
> Another (simpler) option would be to just disable terminate and remove if any
> of the selected launches are not terminated but terminate is disabled... This
> seems like the most correct solution.

This also feels the most correct to me.
Comment 6 Pawel Piech CLA 2011-09-06 15:27:38 EDT
Created attachment 202838 [details]
Fix to disable.
Comment 7 Pawel Piech CLA 2011-09-06 17:18:51 EDT
(In reply to comment #5)
> This also feels the most correct to me.

That settles it then, I committed the fix.  Mike, please have a look.
Comment 8 Michael Rennie CLA 2011-09-08 14:04:11 EDT
looks fine to me
Comment 9 Michael Rennie CLA 2011-09-13 15:42:38 EDT
verified in I20110912-2126