Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » detecting right-click event on tree viewer
detecting right-click event on tree viewer [message #458578] Fri, 15 July 2005 20:31 Go to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
Hi,
I'm a little new to both event handling and tree viewers in SWT. Can
anyone give me some info as to what interfaces and methods I use to be
able to handle a right click event on a tree node using a jface viewer?

Also if I want to do different things for different types of objects in
the node tree is there a way to lookup the type of object the user right
clicked on? I see that master/block api in eclipse forms does this so I'm
thinking it has to be possible. Thanks
Re: detecting right-click event on tree viewer [message #458580 is a reply to message #458578] Fri, 15 July 2005 21:24 Go to previous messageGo to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
Okay, I have most of it figured out and probably should have researched
this more before I posted.

I'm using the addSelectionChangedListener method on the tree viewer that
will let me figure out what type of object the user clicked on. The only
catch is that I want the event to fire also when the user clicks on an
already selected item in the tree. This event only fires when the
selection is changed. I'm looking at the API and can't seem to find the
event on the tree viewer that would let me do that. Any hints?
Re: detecting right-click event on tree viewer [message #458964 is a reply to message #458580] Wed, 27 July 2005 13:46 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Duncan,

You'll have to handle this separately by adding an SWT.MouseDown listener to
the underlying Tree widget, and then using Tree.getItem(Point) with the
event's x and y to determine the TreeItem, if any, that was clicked. Of
course you'll still get the selection change event as well whenever the
selected item changes.

Grant

"Duncan Krebs" <duncan@krebsnet.com> wrote in message
news:a85398bef3dd39c2c63ba8ca17ecbd5f$1@www.eclipse.org...
> Okay, I have most of it figured out and probably should have researched
> this more before I posted.
>
> I'm using the addSelectionChangedListener method on the tree viewer that
> will let me figure out what type of object the user clicked on. The only
> catch is that I want the event to fire also when the user clicks on an
> already selected item in the tree. This event only fires when the
> selection is changed. I'm looking at the API and can't seem to find the
> event on the tree viewer that would let me do that. Any hints?
>
>
Previous Topic:Cairo and Eclipse/SWT 3.1
Next Topic:focusLost on a shell
Goto Forum:
  


Current Time: Mon Oct 19 22:33:28 GMT 2020

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

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

Back to the top