Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » [TreeViewer] post selection changes are not handled as expected (as in RCP)?
[TreeViewer] post selection changes are not handled as expected (as in RCP)? [message #546673] Tue, 13 July 2010 17:40 Go to next message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
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]

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 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
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?
Re: [TreeViewer] post selection changes are not handled as expected (as in RCP)? [message #548495 is a reply to message #548410] Thu, 22 July 2010 07:44 Go to previous message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
Rüdiger Herrmann wrote on Wed, 21 July 2010 13:26
Bogdan,
apparently this is a bug in RAP. Feel free to file a bugzilla...

Yes, I already did it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=32023


Rüdiger Herrmann wrote on Wed, 21 July 2010 13:26

... , 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.

I am already seriously considering it, since I use Display#timerExec() anyway. Thank you!

Previous Topic:sometimes UI cannot automatically refresh, I need to use the mouse to click on UI each tiime
Next Topic:TypeError: undefined is not a function
Goto Forum:
  


Current Time: Tue Feb 27 21:28:07 GMT 2024

Powered by FUDForum. Page generated in 0.02207 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top