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
Greetings,

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
moveUpAction.setId(ACTION_ID_MOVE_UP);
getActionRegistry().registerAction(moveUpAction);
getSelectionActions().add(moveUpAction.getId());
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
SWT.ARROW_UP/DOWN/LEFT/RIGHT.

Thanks for the help in advance,
Kalin
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: Fri Dec 19 21:42:08 GMT 2014

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

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