Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Copy & Paste default behavior
Copy & Paste default behavior [message #825165] Tue, 20 March 2012 14:58 Go to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
Hi,

Current default copy and paste behavior has a couple of problems that could be easily solved (and I am willing to provide both time and code):

* Not using LocalSelectionTransfer properly in the copy behavior prevents it from integrating with other views (see bug #374744)
* The FileTransfer and ResourceTransfer implementations copy the file of the owner resource into the clipboard. Even if this may have some applications, I think they are more likely corner cases. (see bug #361414)
* Using UriTransfer, while allowing local copy very easily, has severe problems when copying into a different diagram.

Proposed solutions:

* A proposed one-liner is already in the bug report
* The File and Resource transfers should be used only if, for every object to be copied, a)the selected object is the only element contained in the given file, or b)the selected object can be adapted to a IResource (to leave an open door for specific implementations). I could attach a patch to the code, if you agree on this proposal.
* The last problem is a bit tricky. Currently, the default copy behavior is to store the copied objects URIs in the clipboard. And the obvious paste implementation is to use AbstractPasteFeature.getCopiesFromClipBoard(diagram) to retrieve them. This way, ModelClipboard resolves the URIs in the target diagram's resourceSet. Even if the copied objects are modified, the ResourceSet resolves the URI to the live, in-memory version of the eobject. However, if we try to paste the eobject in a different diagram, that diagram's resourceset resolves the URI with the stale, in-disk version of the eobject, which may even not exist. If we were using the LocalSelectionTransfer as per the first point, it could be used in ModelClipboard.getContentAsEObjects to retrieve the live eobjects. The current logic in the inner class CopyCommand should succeed in copying the objects in the target editing domain. Again, if you feel this is the way to go, I could provide a working patch.

Regards,
Félix
Re: Copy & Paste default behavior [message #825994 is a reply to message #825165] Wed, 21 March 2012 14:09 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Félix,

thanks for pointing out! All three things appear to be bugs. Would you open
a bugzilla for 3 to track that as well? (2 seems to be tracked already by
361414.)

If you have solutions for these issues and you are willing to contribute,
please feel free to do so. We always appreciate help in solving issues...
:-)

Thanks,
Michael
Re: Copy & Paste default behavior [message #826014 is a reply to message #825994] Wed, 21 March 2012 14:43 Go to previous message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
Done, bug #374918
Previous Topic:Would it be possible to set a node background image from project navigator?
Next Topic:Read diagram from a combined file.
Goto Forum:
  


Current Time: Sat Apr 20 02:15:45 GMT 2024

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

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

Back to the top