tags:

views:

263

answers:

1

We are currently using Eclipse Draw2D/GEF for an information page describing a process in our application. This basically consists of a matrix of large squares, each containing a matrix of smaller squares. We originally had all the squares as GEF objects, but because of the large volume of them being shown, we found that this did not scale very well and the view took a very long time to open. We then changed it so that only the large squares are Figures and we then draw the smaller squares using the graphic in paintFigure.

The problem that we are running into is that we still want the tooltip to change depending on which small square you are hovering over. I tried to do this by adding a mouseMotionListener and setting the tooltip, through setTooltip, depending on where the mouse currently is. The problem is that once the tooltip is displayed, it does not change any more when setTooltip is called.

Does any one know of an alternative way of doing this? Is there a way of getting the viewpart's PopupHelper and using that? Any help would be appreciated.

Thanks

A: 

Hmnn.. interesting problem. Since you paint your own Grid within the Figure, I would think that you have two options.

  1. Try posting SWT events to fool Eclipse. I'd try a focus lost followed by a focused gained, to trigger tooltip machinery, at which point you could get the coordinates and display the appropriate contents.

  2. Don't use the Figure#getTooltip strategy at all. Just show your own composite.

arcticpenguin
Thanks, did not think of posting SWT events. Good idea though. I have, in the mean time, implemented option 2, which works good enough.
If that worked for you can you mark this as a correct answer? It gives points - thanks. :-)
arcticpenguin