CopyToClipboardCommand and DragAndDropCommand behavior questions [message #480519] |
Mon, 17 August 2009 13:26 |
Eclipse User |
|
|
|
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.03016 seconds