Bug 487156 - Auto-selection of processes under launch in run mode fails and clears selection in Debug view
Summary: Auto-selection of processes under launch in run mode fails and clears selecti...
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.5.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-03 12:47 EST by Mattias Bertilsson CLA
Modified: 2020-07-08 04:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mattias Bertilsson CLA 2016-02-03 12:47:07 EST
To reproduce, in the debug perspective, open any java class with a main() method and press Run button in the main toolbar, to run it as a java application. 

The launch and a process node will appear in the Debug view, but usually, at least on the machines I have tried it on, none of them will be selected.

It would be reasonable to expect that either the launch or the process would be selected, since in Run mode there will be no other debug targets or threads that should get focus, and as a user it nice to be able to perform actions on an object I just created, without having to click on it first.

Looking at the source code (please correct me if I am wrong, I am not that familiar with debug platform code), it seems that org.eclipse.debug.internal.ui.viewers.update.ProcessProxy.installed() does try to set the selection to the newly created process, but silently fails in org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToWidget(), when the item corresponding to the new process can't be found in the tree widget. This would not be so bad if it had not already, in org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.handleSelect(), cleared any existing selection in the Debug view.

I don't know what it would take to make the selection in ProcessProxy work as intended, it looks like a race between the different jobs involved in the launch, but simply removing the attempt would at least leave selection in the view unharmed.
Comment 1 Sarika Sinha CLA 2016-02-04 01:56:42 EST
I can reproduce the problem. Will be analyzing the problem and possible solutions.
Comment 2 Eclipse Genie CLA 2020-07-07 10:36:58 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Mattias Bertilsson CLA 2020-07-07 12:56:48 EDT
I do not know if the failing attempt to set selection is still there in the source code in 4.16, but the behavior (clearing previous selection in the Debug view) is.

I noticed though, that if the previous selection is a Java stack frame, it is not cleared. I don't know if that was always the case.
Comment 4 Sarika Sinha CLA 2020-07-08 01:57:30 EDT
Thanks for confirming!

Debug View is for executing in debug mode, this is not supported for run mode .
Comment 5 Mattias Bertilsson CLA 2020-07-08 04:40:54 EDT
(In reply to Sarika Sinha from comment #4)

> Debug View is for executing in debug mode, this is not supported for run
> mode .

I think that is a (re-)interpretation of purpose that would surprise both users and integrators. Please don't make it for the sake of closing this bug.

For the general audience, I do not think this problem is serious and you can work around it by supplying your own IModelSelectionPolicyFactory. I think this bug can be closed as "Wont fix" with that motivation instead.