Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEF4 Tooltip
GEF4 Tooltip [message #1729422] Thu, 14 April 2016 05:27 Go to next message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 90
Registered: July 2009
Location: Wellington, New Zealand
Member

I would like to add tooltips to my GeometryNodes, for any part where the content model has a non empty name property. This was fairly straightforward in Draw2D, as you just set Figure.setToolTip(IFigure), but it seems like there is more work involved in GEF4.

Following the MVC Logo example I have a delete hover handle that appears after a suitable delay, and I traced that back to FXHoverBehavior. I tried creating an extension of FXHoverBehavior, and although I could get that to display a tool tip label, it obviously wasn't right as there were lots of exceptions getting thrown. It feels like there should be some simple hook to add behaviour that happens after the mouse has hovered for a short while, but I can't work out where. FXHoverTool doesn't seem right either, as it is only triggered by the mouse moving, and you would have to add your own listeners somewhere to detect the actual hovering.

It seems like this is an awful lot of work for something that should be really simple. Am I missing something?


Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Re: GEF4 Tooltip [message #1729443 is a reply to message #1729422] Thu, 14 April 2016 08:39 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
As you determined correctly, the hover handles are created after a short delay, so the tooltip could be implemented as a hover handle (e.g. TooltipHoverHandlePart). You would need to create that handle part within the HoverHandlePartFactory, but extending the FXHoverBehavior should not be necessary. However, you can also add a tooltip using JavaFX as follows (which is much more convenient):
public class SomePart ... {
    private Tooltip tooltip = new Tooltip("tooltip-text");
    // ...
    protected Group createVisual() {
        // ...
        Tooltip.install(group, tooltip);
        return group;
    }
    //...
    public doRefreshVisual(Group visual) {
        // ...
        tooltip.setText(getContent().getTooltip());
    }
}


Additionally, you could also create your own CustomHoverBehavior that reacts to HoverModel changes and performs some action after a delay if necessary.

Regards,
Matthias

[Updated on: Thu, 14 April 2016 08:41]

Report message to a moderator

Re: GEF4 Tooltip [message #1729503 is a reply to message #1729443] Thu, 14 April 2016 19:00 Go to previous message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 90
Registered: July 2009
Location: Wellington, New Zealand
Member

D'oh! I thought there had to be a simple way. I'm learning GEF4 and JavaFX at the same time, so I'm never sure if the thing I'm looking for should be in GEF4 or JavaFX. Thanks again.

Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Previous Topic:Registering children of a group
Next Topic:automatic graph creation from xml using eclipse gef
Goto Forum:
  


Current Time: Tue Nov 20 00:18:58 GMT 2018

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

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

Back to the top