Skip to main content



      Home
Home » Eclipse Projects » GEF » GEF4 Tooltip
GEF4 Tooltip [message #1729422] Thu, 14 April 2016 01:27 Go to next message
Eclipse UserFriend
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?
Re: GEF4 Tooltip [message #1729443 is a reply to message #1729422] Thu, 14 April 2016 04:39 Go to previous messageGo to next message
Eclipse UserFriend
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 04:41] by Moderator

Re: GEF4 Tooltip [message #1729503 is a reply to message #1729443] Thu, 14 April 2016 15:00 Go to previous message
Eclipse UserFriend
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.
Previous Topic:automatic graph creation from xml using eclipse gef
Next Topic:How to create an e4 RCP application using GEF4?
Goto Forum:
  


Current Time: Wed Jul 23 16:43:31 EDT 2025

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

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

Back to the top