[TreeViewer] post selection changes are not handled as expected (as in RCP)? [message #546673] |
Tue, 13 July 2010 17:40  |
Eclipse User |
|
|
|
I added a post selection changed listener to my TreeViewer like this:
TreeViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent e) {
System.out.println("post selection changed");
}
});
The problem is that if I change the selection twice very quickly by pressing the arrow up or arrow down key, then "post selection changed" is printed out twice. But it should occur only once - exactly for the last selected element, isn't it?
Because the JavaDoc of IPostSelectionProvider says:
Quote: | * A post selection changed event is equivalent to selection changed event
* if the selection change was triggered by the mouse, but it has a delay
* if the selection change is triggered by keyboard navigation.
|
In RCP I see it only once, as expected.
Use case:
I need to open the selected objects from my Tree in corresponding editors. But if I change selection quickly with the keyboard I only need to open the object I stop on. Not to open all traversed objects. Isn't it the use of post selection anyway?
Could you please advise me what I could do to make it work like in RCP?
[Updated on: Tue, 13 July 2010 17:42] by Moderator Report message to a moderator
|
|
|
Re: [TreeViewer] post selection changes are not handled as expected (as in RCP)? [message #548410 is a reply to message #546673] |
Wed, 21 July 2010 17:26   |
Eclipse User |
|
|
|
Bogdan,
apparently this is a bug in RAP. Feel free to file a bugzilla, however I
doubt that we will be able to fix it.
To work around the issue, you can could implement the delay yourself
with Display#timerExec() or java.util.Timer.
HTH
Rüdiger
On 13.07.2010 19:40, Bogdan B. wrote:
> I added a post selection changed listener to my TreeViewer like this:
> TreeViewer.addPostSelectionChangedListener(new
> ISelectionChangedListener() {
> public void selectionChanged(final SelectionChangedEvent e) {
> System.out.println("post selection changed");
> }
> });
> The problem is that if I change the selection twice very quickly by
> pressing the arrow up or arrow down key, then "post selection changed"
> is printed out twice. But it should occur only once, isn't it? Because
> the JavaDoc of IPostSelectionProvider says:
> Quote:
>> * A post selection changed event is equivalent to selection changed event
>> * if the selection change was triggered by the mouse, but it has a
>> delay * if the selection change is triggered by keyboard navigation.
>
> In RCP I see it only once, as expected.
>
> Use case: I need to open the selected objects from my Tree in
> corresponding editors. But if I change selection quickly with the
> keyboard I only need to open the object I stop on. Not to open all
> traversed objects. Isn't it the use of post selection anyway?
>
> Could you please advise me what I could do to make it work like in RCP?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03547 seconds