Search code examples
javafxeclipse-rcpeclipse-gefzest

How to add Non-Graph Visual Elements in GEF4


I'm developing an Eclipse RCP application to visually model graphs. For this purpose I'm using the GEF4 Zest JFace library (or bundle). A lot of the necessary functionality is coverd by the used Policies, but I need to add an extra visual element: a VBox (or a Panel) with the graph name and a short description. This is not a graph node, so I have placed it in the Canvas Overlay Group of the ZestContentViewer.

final Group canvasOverlay = ui.getGraphViewer().getFXViewer().getCanvas().getOverlayGroup();
            canvasOverlay.getChildren().add(metaPanel);

The method ui.getGraphViewer returns the ZestContentViewer and the metaPanelis the VBox containing the javafx TextFields.

Everything works fine, until I write something in the TextFields. When I press one of the arrow keys, the scroll pane containing the canvas is also triggered (scrolled). Similarly, when I drag the metaPanel a rectangular selection is also started. Is there a way to fix this? I'm not sure this is the right place to put the component, but I do not have any other ideas.


Solution

  • As outlined in the corresponding forum post, you can exchange the ITargetPolicyResolver and prevent processing of events that are already processed by the "meta" panel.