Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Adding a MouseTrackListener to a TreeViewerColumn
Adding a MouseTrackListener to a TreeViewerColumn [message #514911] Wed, 17 February 2010 07:59 Go to next message
TW  is currently offline TW Friend
Messages: 62
Registered: November 2009
Member
Hi,

at the moment I´m having a problem with a MousTrackListener.

I wrote a Listener which pops up a Tooltip when a special Item is selected.

The GUI Object which should open the Tooltip is a FilteredTree which has some TreeViewerColumns.

I can easily add the listener to the whole Tree with the following Code.
filteredTree.getViewer().getTree().addMouseTrackListener( mouseTrack );


But I would prefer, that the tooltip only opens when my Mouse points over a defined TreeViewerColumn.

How can I add the Listener to the TreeViewerColumn instead of adding it to the whole Tree?

Or is this not possible and I have to add the Listener to the Tree and check the hovered Column when catching the MouseHover Event?

Thanks for your help!
Re: Adding a MouseTrackListener to a TreeViewerColumn [message #514913 is a reply to message #514911] Wed, 17 February 2010 08:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You know that ther is ColumnViewerTooltipSupport?

See http://wiki.eclipse.org/JFaceSnippets and
http://tomsondev.bestsolution.at/2009/06/08/galileo-emf-data binding-%E2%80%93-part-3/
for an advanced usage.

Tom

Am 17.02.10 08:59, schrieb TW:
> Hi,
>
> at the moment I´m having a problem with a MousTrackListener.
>
> I wrote a Listener which pops up a Tooltip when a special Item is selected.
>
> The GUI Object which should open the Tooltip is a FilteredTree which has
> some TreeViewerColumns.
>
> I can easily add the listener to the whole Tree with the following Code.
> filteredTree.getViewer().getTree().addMouseTrackListener( mouseTrack );
>
> But I would prefer, that the tooltip only opens when my Mouse points
> over a defined TreeViewerColumn.
>
> How can I add the Listener to the TreeViewerColumn instead of adding it
> to the whole Tree?
>
> Or is this not possible and I have to add the Listener to the Tree and
> check the hovered Column when catching the MouseHover Event?
>
> Thanks for your help!
>
Re: Adding a MouseTrackListener to a TreeViewerColumn [message #514925 is a reply to message #514913] Wed, 17 February 2010 08:53 Go to previous messageGo to next message
TW  is currently offline TW Friend
Messages: 62
Registered: November 2009
Member
HI,

ok so I can open the tooltip by giving a ColumnViewer Object as input.

But the ColumnViewer is my FilteredTree.

I cannot open the tooltip directly, because I want to display Informations about the object which is hovered by the mouse.

I can get the object at which the mouse is pointing at from the MouseEvent.

So I think this doesn´t fix my problem (If I´m wrong please tell me).

--- UPDATE ---

I recognized, that the person in your second Link uses the CellLabelProvider to Display his tooltip.

I want to display my own tooltip which I extended from the Class ToolTip.
Can you tell me how I can do this?

[Updated on: Wed, 17 February 2010 09:04]

Report message to a moderator

Re: Adding a MouseTrackListener to a TreeViewerColumn [message #514958 is a reply to message #514925] Wed, 17 February 2010 05:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes but it uses the information coming from the ColumnLabelProvider and
displays information for each cell in the table.

Do we talk about the the TableColumn-Header or the Table-Cells?

Tom

Am 17.02.10 09:53, schrieb TW:
> HI,
>
> I noticed that I do not have to implement a listener to open the tooltip.
>
> But that doesn´t fix my problem.
>
> The ColumnViewerTooltipSupport shows a tooltip for ColumnViewer Objects.
>
> But the ColumnViewer Object is my FilteredTree and not the
> TreeViewerColumn.
> Can anybody help me here?
Re: Adding a MouseTrackListener to a TreeViewerColumn [message #514992 is a reply to message #514911] Wed, 17 February 2010 12:57 Go to previous messageGo to next message
TW  is currently offline TW Friend
Messages: 62
Registered: November 2009
Member
Hi Tom,

we talk about Tree-Cells of a Tree with Columns.

I looked at the links you posted and tried to implement something like this in my application.

First I extended my ColumnLabelProvider and overwrote the getToolTipText() method.

Then I added a ColumnViewerTooltipSupport for the tree (as far as I know, you can only add this support for the whole tree and then the columns which override the getToolTipText() method show their tooltips).

So that worked quite well.

The problem is, that we already have a Tooltip class which extends the java Tooltip class. Here we have methods to easy add lines with images, bold texts or normal texts.

If I could tell my ColumnLabelProvider to open our own Tooltip for the hovered item, the problem would be fixed. But I could not open a Tooltip from the ColumnLabelProvider.

So I found another solution in the second link in one java snipped. They used the same approch then I and implemented a mouseTrackListener.

When there is a mouseHover-Event, there are some queries which check if the mouse pointer is inside the area of a specified column. If true, the Tooltip is created otherwise it is disposed.

Now my Tooltip only pops up in a special column.
Re: Adding a MouseTrackListener to a TreeViewerColumn [message #515001 is a reply to message #514992] Wed, 17 February 2010 13:11 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Simply subclass ColumnViewerTooltip and overwrite
"createViewerToolTipContentArea". If you look at
http://tomsondev.bestsolution.at/2009/06/08/galileo-emf-data binding-%E2%80%93-part-3/

You see an very advanced version which uses the FormToolKit which is
created in this class:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf/examples/org.eclipse.emf.examples.databinding.p roject.ui.rcp/src/org/eclipse/emf/example/databinding/projec t/ui/rcp/views/ProjectExplorerPart.java?root=Modeling_Projec t&view=markup

Tom

Am 17.02.10 13:57, schrieb TW:
> Hi Tom,
>
> we talk about Tree-Cells of a Tree with Columns.
>
> I looked at the links you posted and tried to implement something like
> this in my application.
>
> First I extended my ColumnLabelProvider and overwrote the
> getToolTipText() method.
>
> Then I added a ColumnViewerTooltipSupport for the tree (as far as I
> know, you can only add this support for the whole tree and then the
> columns which override the getToolTipText() method show their tooltips).
>
> So that worked quite well.
>
> The problem is, that we already have a Tooltip class which extends the
> java Tooltip class. Here we have methods to easy add lines with images,
> bold texts or normal texts.
> If I could tell my ColumnLabelProvider to open our own Tooltip for the
> hovered item, the problem would be fixed. But I could not open a Tooltip
> from the ColumnLabelProvider.
>
> So I found another solution in the second link in one java snipped. They
> used the same approch then I and implemented a mouseTrackListener.
>
> When there is a mouseHover-Event, there are some queries which check if
> the mouse pointer is inside the area of a specified column. If true, the
> Tooltip is created otherwise it is disposed.
>
> Now my Tooltip only pops up in a special column.
Previous Topic:How to control a TableViewer's size?
Next Topic:TableViewer and RGB
Goto Forum:
  


Current Time: Sat Apr 20 16:27:55 GMT 2024

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

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

Back to the top