Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Custom movement with arrow keys
Custom movement with arrow keys [message #658214] Mon, 07 March 2011 12:33
Kalin Nakov is currently offline Kalin NakovFriend
Messages: 6
Registered: October 2010
Junior Member

I would like to implement some custom movement of border items (like UML
ports) with the arrow keys. The default GMF implementation uses the drag
tracker to simulate mouse dragging, which does not fit the product's
requirements. I want to move the border item with a single click of the
arrow keys with some predefined distance and force the border item locator
to snap it in the proper place. Here are the approaches I've tried

- Added a key listener to the draw2d figure with no success - the listener
is not called.
- Overrode DiagramEditor::configureGraphicalViewer() and used this code:

// register keyboard move actions
getKeyHandler().put(KeyStroke.getPressed(SWT.ARROW_UP, 0), moveUpAction);

This code seems to be able to capture only keys like Enter by using
KeyStroke.getPressed(SWT.CR, '\r', 0). But it does not work with

Thanks for the help in advance,
Previous Topic:Diagram partition on Non-top level node
Next Topic:Why edges are not persisted when nodes are? How to change it?
Goto Forum:

Current Time: Tue Mar 09 12:09:26 GMT 2021

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

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

Back to the top