From: platform-debug-dev-bounces@xxxxxxxxxxx [mailto:platform-debug-dev-bounces@xxxxxxxxxxx] On Behalf Of Pawel Piech
Sent: Monday, January 16, 2012 1:51 PM
To: Eclipse Platform Debug component developers list.
Subject: Re: [platform-debug-dev] setting Debug View selection programmatically
Hi,
If you can make an assumption that your element is revealed, then trySelection()/setSelection() will work. It's a dangerous assumption IMO, because a user can collapse the elements manually causing your feature to work unpredictably. For a user a feature that is unpredictable undermines his confidence in the whole product.
Cheers,
Pawel
On 01/16/2012 10:28 AM, Bill Swanson wrote:
Thanks, Pawel --
I have used the updateViewer() trick before (in Tilera's Grid View), and it does work,
but in this case I would need to walk the Debug View tree and build ModelDeltas
more generically. Before doing that, I wanted to make sure I wasn't reinventing
something that already existed.
As it happens, what I want to select (the processes and threads) are generally
already expanded in the Debug View, so assuming that, is trySelection()
still a viable option, or is the ModelDelta method just preferred overall?
--- WRS
Hi Bill,
Except for the model deltas, there currently is no public API for setting selection in the Debug view from the outside. The technical problem is that the Debug view is lazy loading, which means that if try to call setSelection() with an element or even a TreePath, the viewer will not be able to select this element if it has not been revealed yet.
One alternative is to use the ITreeModelViewer.updateViewer() method with a selection delta. This is equivalent to posting the delta from your model and it means that you need to know all the indexes and child counts in the model. But at least you wouldn't have to have a bogus IModelProxy in order to post this delta. Is this a viable solution for you?
If you don't know the debug view layout. You could create a VirtualTreeModelViewer with debug view presentation context ID, and force it to expand all elements. This could get complicated and expensive performance-wise, so it's worth looking at other options first.
Cheers,
Pawel
On 01/11/2012 08:34 AM, Bill Swanson wrote:
As part of the Multicore Visualizer work, I need a mechanism for setting the selection
in the Debug View (e.g. when the user selects threads in the visualizer, the corresponding
Debug View lines if any want to be highlighted).
In the original Grid View, I did this via the hacky method of constructing a Model Delta tree
with appropriate flags and passing it to TreeModelViewer.updateViewer().
However, in redoing this for the multicore visualizer I found there is a method on the viewer,
ITreeModelViewer.trySelection(), that takes a list of the model objects to be selected
and appears to handle setting the selection appropriately.
Is this usage of trySelection() as intended, and are there are any potential issues,
for example is there a planned reorg of the code that might deprecate
or remove this method?
--- WRS
_______________________________________________
platform-debug-dev mailing list
platform-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-debug-dev
_______________________________________________
platform-debug-dev mailing list
platform-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-debug-dev