Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » some Key Bindings not working
some Key Bindings not working [message #1297099] Tue, 15 April 2014 12:19 Go to next message
Martin Hanysz is currently offline Martin HanyszFriend
Messages: 30
Registered: November 2013
Member
Hello Graphiti Community,

I noticed that the default key bindings of my RCP app that uses Graphiti behave a bit strange because some of them work and some don't.

  • If I press [Del] the selected shape gets deleted, the DeleteFeature is invoked
  • If I press [Ctrl + C] nothing happens, the CopyFeature is NOT invoked
  • If I press [Ctrl + S] the diagram is saved
  • If I press [Ctrl + Z] nothing happens, the last modification is NOT undone

As far as I know, all of the above key bindings are defined by Eclipse and not by Graphiti.
In addition, I can invoke the actions that are not invokable by their respective key bindings by clicking the icons in the toolbar. Reviewing the code that generates the toolbar entries shows, that they are linked to the very same command IDs as the default key bindings.

Can you tell me how to make the key bindings work?
How can I make graphiti react to already defined key bindings?

Best regards,
Martin
Re: some Key Bindings not working [message #1300357 is a reply to message #1297099] Thu, 17 April 2014 14:14 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Martin,

do you have an own subclass of DiagramEditor as your editor? In case yes,
you should also register an action bar contributor for that editor (see
org.eclipse.editor extension point), DiagramEditorActionBarContributor is
the default implementation that comes with Graphiti.

Michael
Re: some Key Bindings not working [message #1308744 is a reply to message #1300357] Tue, 22 April 2014 08:35 Go to previous messageGo to next message
Martin Hanysz is currently offline Martin HanyszFriend
Messages: 30
Registered: November 2013
Member
Dear Michael,

Thank you for your answer.

Yes, I use my own subclass of DiagramEditor and I also registered a custom action bar contributor which inherits from DiagramEditorActionBarContributor. It disables the contributions to the main menu by overriding contributeToMenu(IMenuManager) with an empty method. The remaining methods are inherited, especially buildActions(). As far as I understand, this method registers a number of retargetable actions such as copy, paste, delete, redo, undo etc. By doing this, I think the editor is supposed to automatically react to the respective shortcuts for the registered action, e.g. [Del] for delete.

But as I wrote in my previous post, not all of the shortcuts work as I expect them to do. [Ctrl + C] does not copy a Shape, but when the direct editing of a text is active, I am able to copy and paste text. So the editor is reacting to [Ctrl + C] somehow, but not when a Shape is selected.

So my question remains: How can I make [Ctrl + C] and [Ctrl + V] work for copying Shapes?

Best regards,
Martin
Re: some Key Bindings not working [message #1310783 is a reply to message #1308744] Wed, 23 April 2014 11:55 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Martin,

having the registrations of the actions in the action bar contributor is the
precondition. Besides that you should check that
DiagramBehavior.getCommonKeyHandler is called. It registers the keybindings
for copy, paste.

The direct editing replaces the global handlers when it becomes active, so
CTRL-C/CTRL-V behave differently. After deactivation the old handlers get
registered again.

Michael
Previous Topic:Dragging GraphicsAlgorithm inside another GraphicsAlgorithm
Next Topic:Custom look-and-feel for ContextButtonPad
Goto Forum:
  


Current Time: Fri Sep 20 19:14:27 GMT 2024

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

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

Back to the top