Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CopyToClipboardCommand and DragAndDropCommand behavior questions
CopyToClipboardCommand and DragAndDropCommand behavior questions [message #480519] Mon, 17 August 2009 13:26 Go to next message
Eclipse UserFriend
Originally posted by: georgiana.mania.crispico.com

Hello,

I have a question regarding the CopyToClipboardCommand and
DragAndDropCommand in EMF.

The CopyToClipboardCommand uses a CopyCommand to duplicate the selected
elements before Paste. In the Paste command the CopyCommand is used again
to copy the elements from the clipboard (which are the copies of the
selected elements – created by the Copy command).

Also, DragAndDropCommand uses the CopyCommand to create a copy before
moving the selected elements.

What is the purpose of creating so many copies whose references remain in
the memory? In my project, I use my own copy/cut/paste commands that
create only one copy (if needed) at Paste/Drop time. Is there something
that could create problems using this implementation?

Thank you.
Re: CopyToClipboardCommand and DragAndDropCommand behavior questions [message #480520 is a reply to message #480519] Mon, 17 August 2009 13:36 Go to previous message
Ed Merks is currently online Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Georgiana,

Comments below.


Georgiana wrote:
> Hello,
>
> I have a question regarding the CopyToClipboardCommand and
> DragAndDropCommand in EMF.
>
> The CopyToClipboardCommand uses a CopyCommand to duplicate the
> selected elements before Paste.
The clipboard needs a copy, not the original object, which might change.
> In the Paste command the CopyCommand is used again to copy the
> elements from the clipboard (which are the copies of the selected
> elements � created by the Copy command).
The objects added to the model by paste must also not be the same as the
objects in the clipboard because they too might change.
>
> Also, DragAndDropCommand uses the CopyCommand to create a copy before
> moving the selected elements.
It will only create a copy in some cases. The comments in the code
explain those cases.
>
> What is the purpose of creating so many copies whose references remain
> in the memory?
To ensure that the object in the clipboard will never change its state.
> In my project, I use my own copy/cut/paste commands that create only
> one copy (if needed) at Paste/Drop time.
So what if someone modifies the state of the copied object after doing
the copy? That affects the clipboard's state I guess?
> Is there something that could create problems using this implementation?
I imagine so, yes...
> Thank you.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Re: How to use ecore2xml?
Next Topic:Serialization of EAttribute generating an attribute when an element was expected
Goto Forum:
  


Current Time: Fri Apr 26 06:04:37 GMT 2024

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

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

Back to the top