| Let's solve once for all the Eclipse GMF copy-paste problem and then forget about it [message #665205]
||Wed, 13 April 2011 16:25
| emil salageanu
Registered: June 2010
Location: Nice, France
I have seen a lot of posts on this forum related to the copy-paste problem, and no post with a complete solution, just clues.
First of all, to be clear: copy-paste is not implemented in GMF (although it might look as if it was) but everything is there for one to implement it.
I postponed the implementation of the copy-paste functionality of my editor for a long time as I thought it was very difficult to do. When I started this work, I had the first version (very simple, with only one type of object) working the very first day.
I used a document I found on http://www.moskitt.org and I also took a look at the copy-paste implementation in the bonita software (www.bonitasoft.com).
I am working myself for the WorkflowStudio provided by the open source project http://proactive.inria.fr
I wrote a post on my newly created WordPress blog containing a complete solution for the copy-paste functionality within a GMF-based editor.
to whom it may concern:
[Updated on: Tue, 19 April 2011 11:02]
Report message to a moderator
|Re: Let's solve once for all the Eclipse GMF copy-paste problem and then forget about it [message #671271 is a reply to message #665205]
||Tue, 17 May 2011 10:43
| Giovanni De Sossi
Registered: October 2009
Location: Rome, Italy
thank you very much for your really useful solution to this problem, I tested it and it works very well. I've made some minor changes to your code, in MyEditorCopyCommand I stored the (copy of) selected objects directly in the system Clipboard instead of static variable, so MyEditorPasteCommand can retrieve them calling Clipboard.getContents(), obtaining a more decoupled design. Moreover, in MyEditorClipboardSupportGlobalActionHandler I needed to override the 'canPaste' method to enable the corresponding menu item and keyboard shortcut, because the superclass implementation doesn't fit to my needs.
Now, it remains just one problem: the 'cut' command fires after every selection change and compounds the copy command, sometimes returning null even when the copy operation was legal: do you have some tip to solve this problem?
Thank you very much, regards
Powered by FUDForum
. Page generated in 0.02226 seconds