Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » copy paste issue
copy paste issue [message #219306] Thu, 19 February 2009 16:19 Go to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

Hi,

I'm trying to copy and paste single elements from a model into a new
model. Apparently it looks like it's done, since I can see a graphical
copy of that element, but if I try to save the diagram and open it back
it just disappears.

any ideas?? this is starting to drive me crazy. I haven't been able to
find any complete and clear example of a simple copy paste action on GMF.
Many people has already asked this issue on this list before me but it
seems like there aren't any convincing solution.

Please, help!

thank you!
Re: copy paste issue [message #219314 is a reply to message #219306] Thu, 19 February 2009 16:37 Go to previous messageGo to next message
Mario Cervera is currently offline Mario CerveraFriend
Messages: 66
Registered: July 2009
Member
Hi,

I don't really know why that may be happening but as GMF copy & paste didn't
satisfy my requirements I chose to implement my own copy & paste. You can
see a presentation I made here:

http://www.moskitt.org/fileadmin/conselleria/documentacion/P resentaciones/MOSKitt-CopyPasteSupport.pdf

Don't send me an email to the email that is in the presentation because it's
no longer my email :-). The basics of the presentation is that I replaced
via extension points the classes that are executed when making copy & paste
by my classes. If you want to see the code you can download MOSKitt in
www.moskitt.org. It's in the plugin "es.cv.gvcase.mdt.common".

Regards

Mario

"markitus" <jxtamarc@gmail.com> escribi
Re: copy paste issue [message #219327 is a reply to message #219314] Thu, 19 February 2009 16:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

Thanks Mario,

I'm going to take a look to the code right now. By the way, I already
came across with your presentation a few time ago and actually sent you
an email to the given address ;-), I'm not sure if you got to read it.
I'll take a look and let you know if it was of help.

Regards,
Marc.


El dia Thu, 19 Feb 2009 17:37:02 +0100, en/na Mario Cervera va escriure:

> Hi,
>
> I don't really know why that may be happening but as GMF copy & paste
> didn't satisfy my requirements I chose to implement my own copy & paste.
> You can see a presentation I made here:
>
> http://www.moskitt.org/fileadmin/conselleria/documentacion/
Presentaciones/MOSKitt-CopyPasteSupport.pdf
>
> Don't send me an email to the email that is in the presentation because
> it's no longer my email :-). The basics of the presentation is that I
> replaced via extension points the classes that are executed when making
> copy & paste by my classes. If you want to see the code you can download
> MOSKitt in www.moskitt.org. It's in the plugin
> "es.cv.gvcase.mdt.common".
>
> Regards
>
> Mario
>
> "markitus" <jxtamarc@gmail.com> escribió en el mensaje
> news:gnk0r1$ekk$1@build.eclipse.org...
>> Hi,
>>
>> I'm trying to copy and paste single elements from a model into a new
>> model. Apparently it looks like it's done, since I can see a graphical
>> copy of that element, but if I try to save the diagram and open it back
>> it just disappears.
>>
>> any ideas?? this is starting to drive me crazy. I haven't been able to
>> find any complete and clear example of a simple copy paste action on
>> GMF. Many people has already asked this issue on this list before me
>> but it seems like there aren't any convincing solution.
>>
>> Please, help!
>>
>> thank you!
>>
Re: copy paste issue [message #219334 is a reply to message #219327] Thu, 19 February 2009 17:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

I've just tried to download the code of Moskitt project, but it looks
like only the binaries are available. Is there any way to get source
files?

thank you!

El dia Thu, 19 Feb 2009 16:58:50 +0000, en/na markitus va escriure:

> Thanks Mario,
>
> I'm going to take a look to the code right now. By the way, I already
> came across with your presentation a few time ago and actually sent you
> an email to the given address ;-), I'm not sure if you got to read it.
> I'll take a look and let you know if it was of help.
>
> Regards,
> Marc.
>
>
> El dia Thu, 19 Feb 2009 17:37:02 +0100, en/na Mario Cervera va escriure:
>
>> Hi,
>>
>> I don't really know why that may be happening but as GMF copy & paste
>> didn't satisfy my requirements I chose to implement my own copy &
>> paste. You can see a presentation I made here:
>>
>> http://www.moskitt.org/fileadmin/conselleria/documentacion/
> Presentaciones/MOSKitt-CopyPasteSupport.pdf
>>
>> Don't send me an email to the email that is in the presentation because
>> it's no longer my email :-). The basics of the presentation is that I
>> replaced via extension points the classes that are executed when making
>> copy & paste by my classes. If you want to see the code you can
>> download MOSKitt in www.moskitt.org. It's in the plugin
>> "es.cv.gvcase.mdt.common".
>>
>> Regards
>>
>> Mario
>>
>> "markitus" <jxtamarc@gmail.com> escribió en el mensaje
>> news:gnk0r1$ekk$1@build.eclipse.org...
>>> Hi,
>>>
>>> I'm trying to copy and paste single elements from a model into a new
>>> model. Apparently it looks like it's done, since I can see a graphical
>>> copy of that element, but if I try to save the diagram and open it
>>> back it just disappears.
>>>
>>> any ideas?? this is starting to drive me crazy. I haven't been able to
>>> find any complete and clear example of a simple copy paste action on
>>> GMF. Many people has already asked this issue on this list before me
>>> but it seems like there aren't any convincing solution.
>>>
>>> Please, help!
>>>
>>> thank you!
>>>
Re: copy paste issue [message #219357 is a reply to message #219306] Thu, 19 February 2009 18:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas.beyer81.t-online.de

Hi Markitus,

I really struggled a long time with cut, copy & paste, especially
pasting into compartments.

From what I can tell, GMF provides everything you need and implements a
very powerful framework around copy-paste. If you see all the related
classes, its a quiet complex job.
Marios approach might also work for your use-case, unfortunately I never
got it working for my editors.

There is just two little hints, I'd like to give you:
1. Make sure to use uuids for your semantic model as described in this
post:
http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-semantic-model-the-simplest-way
There are lots of others threats in this group, adressing exactly this
issue as well.

2. Fork the class NotationClipboardOperationHelper(in plugin
org.eclipse.gmf.runtime.notation.providers)
and modify the following methods:
a)
static EObject getSemanticPasteTarget(View view) {
View parent = (View) view.eContainer();
return parent.getElement();
}

b)
private boolean shouldAllowPaste(
PasteChildOperation overriddenChildPasteOperation) {
EObject eObject = overriddenChildPasteOperation.getEObject();
EObject parentEObject = overriddenChildPasteOperation
.getParentEObject();
//implement your logic here, that checks, if eObject is allowed zo be
can be pasted in the parentEObject
}

I got the clue from this page:
http://wiki.eclipse.org/GMF_Newsgroup_Q_and_A#How_to_make_co py.2Fpaste_work_on_compartments.3F
, which contains so many useful solutions!!!

Forking basically means, you import the plugin above from the eclipse
cvs base, modify the code and use your customized plugin for your
application, rcp or whatever. (just in case you struggle with the term,
like I used to)
Let me know, if you need any further help.


HTH
Regards,
Thomas



markitus schrieb:
> Hi,
>
> I'm trying to copy and paste single elements from a model into a new
> model. Apparently it looks like it's done, since I can see a graphical
> copy of that element, but if I try to save the diagram and open it back
> it just disappears.
>
> any ideas?? this is starting to drive me crazy. I haven't been able to
> find any complete and clear example of a simple copy paste action on GMF.
> Many people has already asked this issue on this list before me but it
> seems like there aren't any convincing solution.
>
> Please, help!
>
> thank you!
>
Re: copy paste issue [message #219365 is a reply to message #219334] Fri, 20 February 2009 08:05 Go to previous messageGo to next message
Mario Cervera is currently offline Mario CerveraFriend
Messages: 66
Registered: July 2009
Member
You have to download it from the public repository (sorry I didn't mention
this before)



"markitus" <jxtamarc@gmail.com> escribi
Re: copy paste issue [message #219373 is a reply to message #219365] Fri, 20 February 2009 08:06 Go to previous messageGo to next message
Mario Cervera is currently offline Mario CerveraFriend
Messages: 66
Registered: July 2009
Member
The url is http://www.moskitt.org/cas/repositorio/


"Mario Cervera" <mcervera@prodevelop.es> escribi
Re: copy paste issue [message #219538 is a reply to message #219357] Fri, 20 February 2009 13:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

Hi Thomas,

Perhaps I misunderstood or I missed something. But wouldn't the result be
the same (or similar) if we extend AbstractClipboardSupport (which
implements IClipboardSupport) and rewrite these methods?

Anyway, I'm clearly confused, as you see.

My problem is not pasting into compartments , I didn't even get that far
yet :( . I've enabled the copy/Paste option so it shows up in the
contextual menu. I'm being able to copy or paste whatever elements I want
to(graphically), but when I try to make these changes persistent these
new copied elements simply disappear. Even if I add an original object
from the palette after a copy/paste action, the previously copied
elements disappear from the canvas. It is so weird!!

So I'm not sure if i have to rewrite anything since I'm not trying to do
anything special, just a simple copy paste action with simple elements
(not compartments).

Should I expect this to work straight, or should I rewrite some code ?

Thanks for your help.

Marc.

El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va escriure:

> Hi Markitus,
>
> I really struggled a long time with cut, copy & paste, especially
> pasting into compartments.
>
> From what I can tell, GMF provides everything you need and implements a
> very powerful framework around copy-paste. If you see all the related
> classes, its a quiet complex job.
> Marios approach might also work for your use-case, unfortunately I never
> got it working for my editors.
>
> There is just two little hints, I'd like to give you: 1. Make sure to
> use uuids for your semantic model as described in this post:
> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-semantic-
model-the-simplest-way
> There are lots of others threats in this group, adressing exactly this
> issue as well.
>
> 2. Fork the class NotationClipboardOperationHelper(in plugin
> org.eclipse.gmf.runtime.notation.providers)
> and modify the following methods:
> a)
> static EObject getSemanticPasteTarget(View view) {
> View parent = (View) view.eContainer(); return
parent.getElement();
> }
>
> b)
> private boolean shouldAllowPaste(
> PasteChildOperation overriddenChildPasteOperation) {
> EObject eObject = overriddenChildPasteOperation.getEObject();
> EObject parentEObject = overriddenChildPasteOperation
> .getParentEObject();
> //implement your logic here, that checks, if eObject is allowed
zo be
> can be pasted in the parentEObject
> }
>
> I got the clue from this page:
> http://wiki.eclipse.org/
GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
> , which contains so many useful solutions!!!
>
> Forking basically means, you import the plugin above from the eclipse
> cvs base, modify the code and use your customized plugin for your
> application, rcp or whatever. (just in case you struggle with the term,
> like I used to)
> Let me know, if you need any further help.
>
>
> HTH
> Regards,
> Thomas
>
>
>
> markitus schrieb:
>> Hi,
>>
>> I'm trying to copy and paste single elements from a model into a new
>> model. Apparently it looks like it's done, since I can see a graphical
>> copy of that element, but if I try to save the diagram and open it back
>> it just disappears.
>>
>> any ideas?? this is starting to drive me crazy. I haven't been able to
>> find any complete and clear example of a simple copy paste action on
>> GMF. Many people has already asked this issue on this list before me
>> but it seems like there aren't any convincing solution.
>>
>> Please, help!
>>
>> thank you!
>>
Re: copy paste issue [message #219576 is a reply to message #219538] Fri, 20 February 2009 15:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Hello Marc,

it seems you have the same problem I had (and still have). The point
is, that the elements do not disappear after they have been copied, but
that only their views are copied, I guesss. To verify this, please
copy-paste an element and then modify it. If I'm right, the original
element will get changed, too.

However, this is not a solution to your problem (I wish it were, as then
my problem would be solved as well), but maybe it gives you some idea of
where to begin. For me, I tried a few days to solve it before I finally
gave up... :-(

Regards, and good luck,
Tobias



markitus schrieb:
> Hi Thomas,
>
> Perhaps I misunderstood or I missed something. But wouldn't the result be
> the same (or similar) if we extend AbstractClipboardSupport (which
> implements IClipboardSupport) and rewrite these methods?
>
> Anyway, I'm clearly confused, as you see.
>
> My problem is not pasting into compartments , I didn't even get that far
> yet :( . I've enabled the copy/Paste option so it shows up in the
> contextual menu. I'm being able to copy or paste whatever elements I want
> to(graphically), but when I try to make these changes persistent these
> new copied elements simply disappear. Even if I add an original object
> from the palette after a copy/paste action, the previously copied
> elements disappear from the canvas. It is so weird!!
>
> So I'm not sure if i have to rewrite anything since I'm not trying to do
> anything special, just a simple copy paste action with simple elements
> (not compartments).
>
> Should I expect this to work straight, or should I rewrite some code ?
>
> Thanks for your help.
>
> Marc.
>
> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va escriure:
>
>> Hi Markitus,
>>
>> I really struggled a long time with cut, copy & paste, especially
>> pasting into compartments.
>>
>> From what I can tell, GMF provides everything you need and implements a
>> very powerful framework around copy-paste. If you see all the related
>> classes, its a quiet complex job.
>> Marios approach might also work for your use-case, unfortunately I never
>> got it working for my editors.
>>
>> There is just two little hints, I'd like to give you: 1. Make sure to
>> use uuids for your semantic model as described in this post:
>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-semantic-
> model-the-simplest-way
>> There are lots of others threats in this group, adressing exactly this
>> issue as well.
>>
>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>> org.eclipse.gmf.runtime.notation.providers)
>> and modify the following methods:
>> a)
>> static EObject getSemanticPasteTarget(View view) {
>> View parent = (View) view.eContainer(); return
> parent.getElement();
>> }
>>
>> b)
>> private boolean shouldAllowPaste(
>> PasteChildOperation overriddenChildPasteOperation) {
>> EObject eObject = overriddenChildPasteOperation.getEObject();
>> EObject parentEObject = overriddenChildPasteOperation
>> .getParentEObject();
>> //implement your logic here, that checks, if eObject is allowed
> zo be
>> can be pasted in the parentEObject
>> }
>>
>> I got the clue from this page:
>> http://wiki.eclipse.org/
> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>> , which contains so many useful solutions!!!
>>
>> Forking basically means, you import the plugin above from the eclipse
>> cvs base, modify the code and use your customized plugin for your
>> application, rcp or whatever. (just in case you struggle with the term,
>> like I used to)
>> Let me know, if you need any further help.
>>
>>
>> HTH
>> Regards,
>> Thomas
>>
>>
>>
>> markitus schrieb:
>>> Hi,
>>>
>>> I'm trying to copy and paste single elements from a model into a new
>>> model. Apparently it looks like it's done, since I can see a graphical
>>> copy of that element, but if I try to save the diagram and open it back
>>> it just disappears.
>>>
>>> any ideas?? this is starting to drive me crazy. I haven't been able to
>>> find any complete and clear example of a simple copy paste action on
>>> GMF. Many people has already asked this issue on this list before me
>>> but it seems like there aren't any convincing solution.
>>>
>>> Please, help!
>>>
>>> thank you!
>>>
>
Re: copy paste issue [message #219583 is a reply to message #219576] Fri, 20 February 2009 16:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas.beyer81.t-online.de

Never give up, guys ;-)

So first of all:
Did you both make sure to use uuids for your semantic model as I
described earlier in step 1?

If so, copy paste should at least work for elements placed directly on
the canvas.

So you must add the following extension to your plugin-xml:
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
</parser>
</extension>

Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
file-extension of your editor-files.

Step 2 was the solution to make copy/paste work in compartments
(container-elements).


Regards, Thomas


Am 20.02.2009 16:06, schrieb Tobias:
> Hello Marc,
>
> it seems you have the same problem I had (and still have). The point is,
> that the elements do not disappear after they have been copied, but that
> only their views are copied, I guesss. To verify this, please copy-paste
> an element and then modify it. If I'm right, the original element will
> get changed, too.
>
> However, this is not a solution to your problem (I wish it were, as then
> my problem would be solved as well), but maybe it gives you some idea of
> where to begin. For me, I tried a few days to solve it before I finally
> gave up... :-(
>
> Regards, and good luck,
> Tobias
>
>
>
> markitus schrieb:
>> Hi Thomas,
>>
>> Perhaps I misunderstood or I missed something. But wouldn't the result
>> be the same (or similar) if we extend AbstractClipboardSupport (which
>> implements IClipboardSupport) and rewrite these methods?
>> Anyway, I'm clearly confused, as you see.
>> My problem is not pasting into compartments , I didn't even get that
>> far yet :( . I've enabled the copy/Paste option so it shows up in the
>> contextual menu. I'm being able to copy or paste whatever elements I
>> want to(graphically), but when I try to make these changes persistent
>> these new copied elements simply disappear. Even if I add an original
>> object from the palette after a copy/paste action, the previously
>> copied elements disappear from the canvas. It is so weird!!
>>
>> So I'm not sure if i have to rewrite anything since I'm not trying to
>> do anything special, just a simple copy paste action with simple
>> elements (not compartments).
>> Should I expect this to work straight, or should I rewrite some code ?
>>
>> Thanks for your help.
>>
>> Marc.
>>
>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va escriure:
>>
>>> Hi Markitus,
>>>
>>> I really struggled a long time with cut, copy & paste, especially
>>> pasting into compartments.
>>>
>>> From what I can tell, GMF provides everything you need and implements a
>>> very powerful framework around copy-paste. If you see all the related
>>> classes, its a quiet complex job.
>>> Marios approach might also work for your use-case, unfortunately I never
>>> got it working for my editors.
>>>
>>> There is just two little hints, I'd like to give you: 1. Make sure to
>>> use uuids for your semantic model as described in this post:
>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-semantic-
>> model-the-simplest-way
>>> There are lots of others threats in this group, adressing exactly this
>>> issue as well.
>>>
>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>> org.eclipse.gmf.runtime.notation.providers)
>>> and modify the following methods:
>>> a)
>>> static EObject getSemanticPasteTarget(View view) {
>>> View parent = (View) view.eContainer(); return
>> parent.getElement();
>>> }
>>>
>>> b)
>>> private boolean shouldAllowPaste(
>>> PasteChildOperation overriddenChildPasteOperation) {
>>> EObject eObject = overriddenChildPasteOperation.getEObject();
>>> EObject parentEObject = overriddenChildPasteOperation
>>> .getParentEObject();
>>> //implement your logic here, that checks, if eObject is allowed
>> zo be
>>> can be pasted in the parentEObject
>>> }
>>>
>>> I got the clue from this page:
>>> http://wiki.eclipse.org/
>> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>> , which contains so many useful solutions!!!
>>>
>>> Forking basically means, you import the plugin above from the eclipse
>>> cvs base, modify the code and use your customized plugin for your
>>> application, rcp or whatever. (just in case you struggle with the term,
>>> like I used to)
>>> Let me know, if you need any further help.
>>>
>>>
>>> HTH
>>> Regards,
>>> Thomas
>>>
>>>
>>>
>>> markitus schrieb:
>>>> Hi,
>>>>
>>>> I'm trying to copy and paste single elements from a model into a new
>>>> model. Apparently it looks like it's done, since I can see a graphical
>>>> copy of that element, but if I try to save the diagram and open it back
>>>> it just disappears.
>>>>
>>>> any ideas?? this is starting to drive me crazy. I haven't been able to
>>>> find any complete and clear example of a simple copy paste action on
>>>> GMF. Many people has already asked this issue on this list before me
>>>> but it seems like there aren't any convincing solution.
>>>>
>>>> Please, help!
>>>>
>>>> thank you!
>>>>
>>
Re: copy paste issue [message #219706 is a reply to message #219583] Mon, 23 February 2009 09:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

Hi Thomas,

I did exactly as you said (step 1). Actually it was already done before I
started trying to copy paste. I'm getting the same errors as Tobias. If I
change smth in the new copied element, whatever change I do on this new
element, is reflected on the original too. So there must be some base
errors that leads us to this behavior.

I can't understand why it's behaving like this, and for sure I don't want
to give up ( I can't ), but it's really starting to be quite
discouraging. It seems so obvious that it should SIMPLY work...

good to know, Tobias, that I'm not alone in this fight!


El dia Fri, 20 Feb 2009 17:12:12 +0100, en/na Thomas Beyer va escriure:

> Never give up, guys ;-)
>
> So first of all:
> Did you both make sure to use uuids for your semantic model as I
> described earlier in step 1?
>
> If so, copy paste should at least work for elements placed directly on
> the canvas.
>
> So you must add the following extension to your plugin-xml: <extension
> point="org.eclipse.emf.ecore.extension_parser">
> <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
> class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
> </parser>
> </extension>
>
> Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
> file-extension of your editor-files.
>
> Step 2 was the solution to make copy/paste work in compartments
> (container-elements).
>
>
> Regards, Thomas
>
>
> Am 20.02.2009 16:06, schrieb Tobias:
>> Hello Marc,
>>
>> it seems you have the same problem I had (and still have). The point
>> is, that the elements do not disappear after they have been copied, but
>> that only their views are copied, I guesss. To verify this, please
>> copy-paste an element and then modify it. If I'm right, the original
>> element will get changed, too.
>>
>> However, this is not a solution to your problem (I wish it were, as
>> then my problem would be solved as well), but maybe it gives you some
>> idea of where to begin. For me, I tried a few days to solve it before I
>> finally gave up... :-(
>>
>> Regards, and good luck,
>> Tobias
>>
>>
>>
>> markitus schrieb:
>>> Hi Thomas,
>>>
>>> Perhaps I misunderstood or I missed something. But wouldn't the result
>>> be the same (or similar) if we extend AbstractClipboardSupport (which
>>> implements IClipboardSupport) and rewrite these methods? Anyway, I'm
>>> clearly confused, as you see. My problem is not pasting into
>>> compartments , I didn't even get that far yet :( . I've enabled the
>>> copy/Paste option so it shows up in the contextual menu. I'm being
>>> able to copy or paste whatever elements I want to(graphically), but
>>> when I try to make these changes persistent these new copied elements
>>> simply disappear. Even if I add an original object from the palette
>>> after a copy/paste action, the previously copied elements disappear
>>> from the canvas. It is so weird!!
>>>
>>> So I'm not sure if i have to rewrite anything since I'm not trying to
>>> do anything special, just a simple copy paste action with simple
>>> elements (not compartments).
>>> Should I expect this to work straight, or should I rewrite some code ?
>>>
>>> Thanks for your help.
>>>
>>> Marc.
>>>
>>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va
>>> escriure:
>>>
>>>> Hi Markitus,
>>>>
>>>> I really struggled a long time with cut, copy & paste, especially
>>>> pasting into compartments.
>>>>
>>>> From what I can tell, GMF provides everything you need and implements
>>>> a very powerful framework around copy-paste. If you see all the
>>>> related classes, its a quiet complex job.
>>>> Marios approach might also work for your use-case, unfortunately I
>>>> never got it working for my editors.
>>>>
>>>> There is just two little hints, I'd like to give you: 1. Make sure to
>>>> use uuids for your semantic model as described in this post:
>>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-
semantic-
>>> model-the-simplest-way
>>>> There are lots of others threats in this group, adressing exactly
>>>> this issue as well.
>>>>
>>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>>> org.eclipse.gmf.runtime.notation.providers) and modify the following
>>>> methods:
>>>> a)
>>>> static EObject getSemanticPasteTarget(View view) { View parent =
>>>> (View) view.eContainer(); return
>>> parent.getElement();
>>>> }
>>>>
>>>> b)
>>>> private boolean shouldAllowPaste(
>>>> PasteChildOperation overriddenChildPasteOperation) { EObject eObject
>>>> = overriddenChildPasteOperation.getEObject(); EObject parentEObject =
>>>> overriddenChildPasteOperation .getParentEObject();
>>>> //implement your logic here, that checks, if eObject is allowed
>>> zo be
>>>> can be pasted in the parentEObject
>>>> }
>>>>
>>>> I got the clue from this page:
>>>> http://wiki.eclipse.org/
>>> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>>> , which contains so many useful solutions!!!
>>>>
>>>> Forking basically means, you import the plugin above from the eclipse
>>>> cvs base, modify the code and use your customized plugin for your
>>>> application, rcp or whatever. (just in case you struggle with the
>>>> term, like I used to)
>>>> Let me know, if you need any further help.
>>>>
>>>>
>>>> HTH
>>>> Regards,
>>>> Thomas
>>>>
>>>>
>>>>
>>>> markitus schrieb:
>>>>> Hi,
>>>>>
>>>>> I'm trying to copy and paste single elements from a model into a new
>>>>> model. Apparently it looks like it's done, since I can see a
>>>>> graphical copy of that element, but if I try to save the diagram and
>>>>> open it back it just disappears.
>>>>>
>>>>> any ideas?? this is starting to drive me crazy. I haven't been able
>>>>> to find any complete and clear example of a simple copy paste action
>>>>> on GMF. Many people has already asked this issue on this list before
>>>>> me but it seems like there aren't any convincing solution.
>>>>>
>>>>> Please, help!
>>>>>
>>>>> thank you!
>>>>>
>>>>>
Re: copy paste issue [message #219772 is a reply to message #219706] Mon, 23 February 2009 17:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas.beyer81.t-online.de

Hello Markitus,

the behaviour you describe sounds to me like you are using shortcuts,
not real copies of elements.
How do you create your copy?
Select -> <Ctrl> + <C> -> <Ctrl> + <V> ?

Regards Thomas

markitus schrieb:
> Hi Thomas,
>
> I did exactly as you said (step 1). Actually it was already done before I
> started trying to copy paste. I'm getting the same errors as Tobias. If I
> change smth in the new copied element, whatever change I do on this new
> element, is reflected on the original too. So there must be some base
> errors that leads us to this behavior.
>
> I can't understand why it's behaving like this, and for sure I don't want
> to give up ( I can't ), but it's really starting to be quite
> discouraging. It seems so obvious that it should SIMPLY work...
>
> good to know, Tobias, that I'm not alone in this fight!
>
>
> El dia Fri, 20 Feb 2009 17:12:12 +0100, en/na Thomas Beyer va escriure:
>
>> Never give up, guys ;-)
>>
>> So first of all:
>> Did you both make sure to use uuids for your semantic model as I
>> described earlier in step 1?
>>
>> If so, copy paste should at least work for elements placed directly on
>> the canvas.
>>
>> So you must add the following extension to your plugin-xml: <extension
>> point="org.eclipse.emf.ecore.extension_parser">
>> <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
>> class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
>> </parser>
>> </extension>
>>
>> Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
>> file-extension of your editor-files.
>>
>> Step 2 was the solution to make copy/paste work in compartments
>> (container-elements).
>>
>>
>> Regards, Thomas
>>
>>
>> Am 20.02.2009 16:06, schrieb Tobias:
>>> Hello Marc,
>>>
>>> it seems you have the same problem I had (and still have). The point
>>> is, that the elements do not disappear after they have been copied, but
>>> that only their views are copied, I guesss. To verify this, please
>>> copy-paste an element and then modify it. If I'm right, the original
>>> element will get changed, too.
>>>
>>> However, this is not a solution to your problem (I wish it were, as
>>> then my problem would be solved as well), but maybe it gives you some
>>> idea of where to begin. For me, I tried a few days to solve it before I
>>> finally gave up... :-(
>>>
>>> Regards, and good luck,
>>> Tobias
>>>
>>>
>>>
>>> markitus schrieb:
>>>> Hi Thomas,
>>>>
>>>> Perhaps I misunderstood or I missed something. But wouldn't the result
>>>> be the same (or similar) if we extend AbstractClipboardSupport (which
>>>> implements IClipboardSupport) and rewrite these methods? Anyway, I'm
>>>> clearly confused, as you see. My problem is not pasting into
>>>> compartments , I didn't even get that far yet :( . I've enabled the
>>>> copy/Paste option so it shows up in the contextual menu. I'm being
>>>> able to copy or paste whatever elements I want to(graphically), but
>>>> when I try to make these changes persistent these new copied elements
>>>> simply disappear. Even if I add an original object from the palette
>>>> after a copy/paste action, the previously copied elements disappear
>>>> from the canvas. It is so weird!!
>>>>
>>>> So I'm not sure if i have to rewrite anything since I'm not trying to
>>>> do anything special, just a simple copy paste action with simple
>>>> elements (not compartments).
>>>> Should I expect this to work straight, or should I rewrite some code ?
>>>>
>>>> Thanks for your help.
>>>>
>>>> Marc.
>>>>
>>>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va
>>>> escriure:
>>>>
>>>>> Hi Markitus,
>>>>>
>>>>> I really struggled a long time with cut, copy & paste, especially
>>>>> pasting into compartments.
>>>>>
>>>>> From what I can tell, GMF provides everything you need and implements
>>>>> a very powerful framework around copy-paste. If you see all the
>>>>> related classes, its a quiet complex job.
>>>>> Marios approach might also work for your use-case, unfortunately I
>>>>> never got it working for my editors.
>>>>>
>>>>> There is just two little hints, I'd like to give you: 1. Make sure to
>>>>> use uuids for your semantic model as described in this post:
>>>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-
> semantic-
>>>> model-the-simplest-way
>>>>> There are lots of others threats in this group, adressing exactly
>>>>> this issue as well.
>>>>>
>>>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>>>> org.eclipse.gmf.runtime.notation.providers) and modify the following
>>>>> methods:
>>>>> a)
>>>>> static EObject getSemanticPasteTarget(View view) { View parent =
>>>>> (View) view.eContainer(); return
>>>> parent.getElement();
>>>>> }
>>>>>
>>>>> b)
>>>>> private boolean shouldAllowPaste(
>>>>> PasteChildOperation overriddenChildPasteOperation) { EObject eObject
>>>>> = overriddenChildPasteOperation.getEObject(); EObject parentEObject =
>>>>> overriddenChildPasteOperation .getParentEObject();
>>>>> //implement your logic here, that checks, if eObject is allowed
>>>> zo be
>>>>> can be pasted in the parentEObject
>>>>> }
>>>>>
>>>>> I got the clue from this page:
>>>>> http://wiki.eclipse.org/
>>>> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>>>> , which contains so many useful solutions!!!
>>>>>
>>>>> Forking basically means, you import the plugin above from the eclipse
>>>>> cvs base, modify the code and use your customized plugin for your
>>>>> application, rcp or whatever. (just in case you struggle with the
>>>>> term, like I used to)
>>>>> Let me know, if you need any further help.
>>>>>
>>>>>
>>>>> HTH
>>>>> Regards,
>>>>> Thomas
>>>>>
>>>>>
>>>>>
>>>>> markitus schrieb:
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to copy and paste single elements from a model into a new
>>>>>> model. Apparently it looks like it's done, since I can see a
>>>>>> graphical copy of that element, but if I try to save the diagram and
>>>>>> open it back it just disappears.
>>>>>>
>>>>>> any ideas?? this is starting to drive me crazy. I haven't been able
>>>>>> to find any complete and clear example of a simple copy paste action
>>>>>> on GMF. Many people has already asked this issue on this list before
>>>>>> me but it seems like there aren't any convincing solution.
>>>>>>
>>>>>> Please, help!
>>>>>>
>>>>>> thank you!
>>>>>>
>>>>>>
>
Re: copy paste issue [message #219796 is a reply to message #219772] Tue, 24 February 2009 08:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

Hi Thomas,

I create a copy through the context menu (right-click on selected element
(s)), then copy/cut and paste. Easy, straightforward. Actually, it
doesn't work at all if I try with shortcuts.

Weird weird weird. I guess it has something to do with the original
creation of the ecore. The thing is that the development of this app
started around 2 years ago, and perhaps it's a bit too late to start back
again from scratch.

thanks for your help.

REGARDS,
Marc.

El dia Mon, 23 Feb 2009 18:58:35 +0100, en/na Thomas Beyer va escriure:

> Hello Markitus,
>
> the behaviour you describe sounds to me like you are using shortcuts,
> not real copies of elements.
> How do you create your copy?
> Select -> <Ctrl> + <C> -> <Ctrl> + <V> ?
>
> Regards Thomas
>
> markitus schrieb:
>> Hi Thomas,
>>
>> I did exactly as you said (step 1). Actually it was already done before
>> I started trying to copy paste. I'm getting the same errors as Tobias.
>> If I change smth in the new copied element, whatever change I do on
>> this new element, is reflected on the original too. So there must be
>> some base errors that leads us to this behavior.
>>
>> I can't understand why it's behaving like this, and for sure I don't
>> want to give up ( I can't ), but it's really starting to be quite
>> discouraging. It seems so obvious that it should SIMPLY work...
>>
>> good to know, Tobias, that I'm not alone in this fight!
>>
>>
>> El dia Fri, 20 Feb 2009 17:12:12 +0100, en/na Thomas Beyer va escriure:
>>
>>> Never give up, guys ;-)
>>>
>>> So first of all:
>>> Did you both make sure to use uuids for your semantic model as I
>>> described earlier in step 1?
>>>
>>> If so, copy paste should at least work for elements placed directly on
>>> the canvas.
>>>
>>> So you must add the following extension to your plugin-xml: <extension
>>> point="org.eclipse.emf.ecore.extension_parser">
>>> <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
>>> class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
>>> </parser>
>>> </extension>
>>>
>>> Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
>>> file-extension of your editor-files.
>>>
>>> Step 2 was the solution to make copy/paste work in compartments
>>> (container-elements).
>>>
>>>
>>> Regards, Thomas
>>>
>>>
>>> Am 20.02.2009 16:06, schrieb Tobias:
>>>> Hello Marc,
>>>>
>>>> it seems you have the same problem I had (and still have). The point
>>>> is, that the elements do not disappear after they have been copied,
>>>> but that only their views are copied, I guesss. To verify this,
>>>> please copy-paste an element and then modify it. If I'm right, the
>>>> original element will get changed, too.
>>>>
>>>> However, this is not a solution to your problem (I wish it were, as
>>>> then my problem would be solved as well), but maybe it gives you some
>>>> idea of where to begin. For me, I tried a few days to solve it before
>>>> I finally gave up... :-(
>>>>
>>>> Regards, and good luck,
>>>> Tobias
>>>>
>>>>
>>>>
>>>> markitus schrieb:
>>>>> Hi Thomas,
>>>>>
>>>>> Perhaps I misunderstood or I missed something. But wouldn't the
>>>>> result be the same (or similar) if we extend
>>>>> AbstractClipboardSupport (which implements IClipboardSupport) and
>>>>> rewrite these methods? Anyway, I'm clearly confused, as you see. My
>>>>> problem is not pasting into compartments , I didn't even get that
>>>>> far yet :( . I've enabled the copy/Paste option so it shows up in
>>>>> the contextual menu. I'm being able to copy or paste whatever
>>>>> elements I want to(graphically), but when I try to make these
>>>>> changes persistent these new copied elements simply disappear. Even
>>>>> if I add an original object from the palette after a copy/paste
>>>>> action, the previously copied elements disappear from the canvas. It
>>>>> is so weird!!
>>>>>
>>>>> So I'm not sure if i have to rewrite anything since I'm not trying
>>>>> to do anything special, just a simple copy paste action with simple
>>>>> elements (not compartments).
>>>>> Should I expect this to work straight, or should I rewrite some code
>>>>> ?
>>>>>
>>>>> Thanks for your help.
>>>>>
>>>>> Marc.
>>>>>
>>>>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va
>>>>> escriure:
>>>>>
>>>>>> Hi Markitus,
>>>>>>
>>>>>> I really struggled a long time with cut, copy & paste, especially
>>>>>> pasting into compartments.
>>>>>>
>>>>>> From what I can tell, GMF provides everything you need and
>>>>>> implements a very powerful framework around copy-paste. If you see
>>>>>> all the related classes, its a quiet complex job. Marios approach
>>>>>> might also work for your use-case, unfortunately I never got it
>>>>>> working for my editors.
>>>>>>
>>>>>> There is just two little hints, I'd like to give you: 1. Make sure
>>>>>> to use uuids for your semantic model as described in this post:
>>>>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-
>> semantic-
>>>>> model-the-simplest-way
>>>>>> There are lots of others threats in this group, adressing exactly
>>>>>> this issue as well.
>>>>>>
>>>>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>>>>> org.eclipse.gmf.runtime.notation.providers) and modify the
>>>>>> following methods:
>>>>>> a)
>>>>>> static EObject getSemanticPasteTarget(View view) { View parent =
>>>>>> (View) view.eContainer(); return
>>>>> parent.getElement();
>>>>>> }
>>>>>>
>>>>>> b)
>>>>>> private boolean shouldAllowPaste(
>>>>>> PasteChildOperation overriddenChildPasteOperation) { EObject
>>>>>> eObject = overriddenChildPasteOperation.getEObject(); EObject
>>>>>> parentEObject = overriddenChildPasteOperation .getParentEObject();
>>>>>> //implement your logic here, that checks, if eObject is allowed
>>>>> zo be
>>>>>> can be pasted in the parentEObject
>>>>>> }
>>>>>>
>>>>>> I got the clue from this page:
>>>>>> http://wiki.eclipse.org/
>>>>>
GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>>>>> , which contains so many useful solutions!!!
>>>>>>
>>>>>> Forking basically means, you import the plugin above from the
>>>>>> eclipse cvs base, modify the code and use your customized plugin
>>>>>> for your application, rcp or whatever. (just in case you struggle
>>>>>> with the term, like I used to)
>>>>>> Let me know, if you need any further help.
>>>>>>
>>>>>>
>>>>>> HTH
>>>>>> Regards,
>>>>>> Thomas
>>>>>>
>>>>>>
>>>>>>
>>>>>> markitus schrieb:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm trying to copy and paste single elements from a model into a
>>>>>>> new model. Apparently it looks like it's done, since I can see a
>>>>>>> graphical copy of that element, but if I try to save the diagram
>>>>>>> and open it back it just disappears.
>>>>>>>
>>>>>>> any ideas?? this is starting to drive me crazy. I haven't been
>>>>>>> able to find any complete and clear example of a simple copy paste
>>>>>>> action on GMF. Many people has already asked this issue on this
>>>>>>> list before me but it seems like there aren't any convincing
>>>>>>> solution.
>>>>>>>
>>>>>>> Please, help!
>>>>>>>
>>>>>>> thank you!
>>>>>>>
>>>>>>>
>>>>>>>
Re: copy paste issue [message #226856 is a reply to message #219796] Tue, 21 April 2009 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: awacs.batacs.de

Hi Marc,

unfortunately I ran into the same problems, recently. Copy/paste
basically works - meaning I am able to copy compartments and components
from one compartment to another (visually). If I modify properties of
the copied component/compartment, the source-component/compartment is
changed too. After reopening the diagram file, all copied elements
disappeared, although they are still visible in the generated xmi-file.
I am already using uuids.

Did you already manage to get copy/paste working? Any hints?

Thanks in advance,

Daniel

markitus wrote:
> Hi Thomas,
>
> I create a copy through the context menu (right-click on selected element
> (s)), then copy/cut and paste. Easy, straightforward. Actually, it
> doesn't work at all if I try with shortcuts.
>
> Weird weird weird. I guess it has something to do with the original
> creation of the ecore. The thing is that the development of this app
> started around 2 years ago, and perhaps it's a bit too late to start back
> again from scratch.
>
> thanks for your help.
>
> REGARDS,
> Marc.
>
> El dia Mon, 23 Feb 2009 18:58:35 +0100, en/na Thomas Beyer va escriure:
>
>> Hello Markitus,
>>
>> the behaviour you describe sounds to me like you are using shortcuts,
>> not real copies of elements.
>> How do you create your copy?
>> Select -> <Ctrl> + <C> -> <Ctrl> + <V> ?
>>
>> Regards Thomas
>>
>> markitus schrieb:
>>> Hi Thomas,
>>>
>>> I did exactly as you said (step 1). Actually it was already done before
>>> I started trying to copy paste. I'm getting the same errors as Tobias.
>>> If I change smth in the new copied element, whatever change I do on
>>> this new element, is reflected on the original too. So there must be
>>> some base errors that leads us to this behavior.
>>>
>>> I can't understand why it's behaving like this, and for sure I don't
>>> want to give up ( I can't ), but it's really starting to be quite
>>> discouraging. It seems so obvious that it should SIMPLY work...
>>>
>>> good to know, Tobias, that I'm not alone in this fight!
>>>
>>>
>>> El dia Fri, 20 Feb 2009 17:12:12 +0100, en/na Thomas Beyer va escriure:
>>>
>>>> Never give up, guys ;-)
>>>>
>>>> So first of all:
>>>> Did you both make sure to use uuids for your semantic model as I
>>>> described earlier in step 1?
>>>>
>>>> If so, copy paste should at least work for elements placed directly on
>>>> the canvas.
>>>>
>>>> So you must add the following extension to your plugin-xml: <extension
>>>> point="org.eclipse.emf.ecore.extension_parser">
>>>> <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
>>>> class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
>>>> </parser>
>>>> </extension>
>>>>
>>>> Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
>>>> file-extension of your editor-files.
>>>>
>>>> Step 2 was the solution to make copy/paste work in compartments
>>>> (container-elements).
>>>>
>>>>
>>>> Regards, Thomas
>>>>
>>>>
>>>> Am 20.02.2009 16:06, schrieb Tobias:
>>>>> Hello Marc,
>>>>>
>>>>> it seems you have the same problem I had (and still have). The point
>>>>> is, that the elements do not disappear after they have been copied,
>>>>> but that only their views are copied, I guesss. To verify this,
>>>>> please copy-paste an element and then modify it. If I'm right, the
>>>>> original element will get changed, too.
>>>>>
>>>>> However, this is not a solution to your problem (I wish it were, as
>>>>> then my problem would be solved as well), but maybe it gives you some
>>>>> idea of where to begin. For me, I tried a few days to solve it before
>>>>> I finally gave up... :-(
>>>>>
>>>>> Regards, and good luck,
>>>>> Tobias
>>>>>
>>>>>
>>>>>
>>>>> markitus schrieb:
>>>>>> Hi Thomas,
>>>>>>
>>>>>> Perhaps I misunderstood or I missed something. But wouldn't the
>>>>>> result be the same (or similar) if we extend
>>>>>> AbstractClipboardSupport (which implements IClipboardSupport) and
>>>>>> rewrite these methods? Anyway, I'm clearly confused, as you see. My
>>>>>> problem is not pasting into compartments , I didn't even get that
>>>>>> far yet :( . I've enabled the copy/Paste option so it shows up in
>>>>>> the contextual menu. I'm being able to copy or paste whatever
>>>>>> elements I want to(graphically), but when I try to make these
>>>>>> changes persistent these new copied elements simply disappear. Even
>>>>>> if I add an original object from the palette after a copy/paste
>>>>>> action, the previously copied elements disappear from the canvas. It
>>>>>> is so weird!!
>>>>>>
>>>>>> So I'm not sure if i have to rewrite anything since I'm not trying
>>>>>> to do anything special, just a simple copy paste action with simple
>>>>>> elements (not compartments).
>>>>>> Should I expect this to work straight, or should I rewrite some code
>>>>>> ?
>>>>>>
>>>>>> Thanks for your help.
>>>>>>
>>>>>> Marc.
>>>>>>
>>>>>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va
>>>>>> escriure:
>>>>>>
>>>>>>> Hi Markitus,
>>>>>>>
>>>>>>> I really struggled a long time with cut, copy & paste, especially
>>>>>>> pasting into compartments.
>>>>>>>
>>>>>>> From what I can tell, GMF provides everything you need and
>>>>>>> implements a very powerful framework around copy-paste. If you see
>>>>>>> all the related classes, its a quiet complex job. Marios approach
>>>>>>> might also work for your use-case, unfortunately I never got it
>>>>>>> working for my editors.
>>>>>>>
>>>>>>> There is just two little hints, I'd like to give you: 1. Make sure
>>>>>>> to use uuids for your semantic model as described in this post:
>>>>>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-
>>> semantic-
>>>>>> model-the-simplest-way
>>>>>>> There are lots of others threats in this group, adressing exactly
>>>>>>> this issue as well.
>>>>>>>
>>>>>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>>>>>> org.eclipse.gmf.runtime.notation.providers) and modify the
>>>>>>> following methods:
>>>>>>> a)
>>>>>>> static EObject getSemanticPasteTarget(View view) { View parent =
>>>>>>> (View) view.eContainer(); return
>>>>>> parent.getElement();
>>>>>>> }
>>>>>>>
>>>>>>> b)
>>>>>>> private boolean shouldAllowPaste(
>>>>>>> PasteChildOperation overriddenChildPasteOperation) { EObject
>>>>>>> eObject = overriddenChildPasteOperation.getEObject(); EObject
>>>>>>> parentEObject = overriddenChildPasteOperation .getParentEObject();
>>>>>>> //implement your logic here, that checks, if eObject is allowed
>>>>>> zo be
>>>>>>> can be pasted in the parentEObject
>>>>>>> }
>>>>>>>
>>>>>>> I got the clue from this page:
>>>>>>> http://wiki.eclipse.org/
> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>>>>>> , which contains so many useful solutions!!!
>>>>>>>
>>>>>>> Forking basically means, you import the plugin above from the
>>>>>>> eclipse cvs base, modify the code and use your customized plugin
>>>>>>> for your application, rcp or whatever. (just in case you struggle
>>>>>>> with the term, like I used to)
>>>>>>> Let me know, if you need any further help.
>>>>>>>
>>>>>>>
>>>>>>> HTH
>>>>>>> Regards,
>>>>>>> Thomas
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> markitus schrieb:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm trying to copy and paste single elements from a model into a
>>>>>>>> new model. Apparently it looks like it's done, since I can see a
>>>>>>>> graphical copy of that element, but if I try to save the diagram
>>>>>>>> and open it back it just disappears.
>>>>>>>>
>>>>>>>> any ideas?? this is starting to drive me crazy. I haven't been
>>>>>>>> able to find any complete and clear example of a simple copy paste
>>>>>>>> action on GMF. Many people has already asked this issue on this
>>>>>>>> list before me but it seems like there aren't any convincing
>>>>>>>> solution.
>>>>>>>>
>>>>>>>> Please, help!
>>>>>>>>
>>>>>>>> thank you!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>
Re: copy paste issue [message #226975 is a reply to message #226856] Wed, 22 April 2009 10:53 Go to previous message
Eclipse UserFriend
Originally posted by: jxtamarc.gmail.com

El dia Tue, 21 Apr 2009 16:00:10 +0200, en/na Daniel va escriure:

> Hi Marc,
>
> unfortunately I ran into the same problems, recently. Copy/paste
> basically works - meaning I am able to copy compartments and components
> from one compartment to another (visually). If I modify properties of
> the copied component/compartment, the source-component/compartment is
> changed too. After reopening the diagram file, all copied elements
> disappeared, although they are still visible in the generated xmi-file.
> I am already using uuids.
>
> Did you already manage to get copy/paste working? Any hints?
>
> Thanks in advance,
>
> Daniel
>
> markitus wrote:
>> Hi Thomas,
>>
>> I create a copy through the context menu (right-click on selected
>> element (s)), then copy/cut and paste. Easy, straightforward. Actually,
>> it doesn't work at all if I try with shortcuts.
>>
>> Weird weird weird. I guess it has something to do with the original
>> creation of the ecore. The thing is that the development of this app
>> started around 2 years ago, and perhaps it's a bit too late to start
>> back again from scratch.
>>
>> thanks for your help.
>>
>> REGARDS,
>> Marc.
>>
>> El dia Mon, 23 Feb 2009 18:58:35 +0100, en/na Thomas Beyer va escriure:
>>
>>> Hello Markitus,
>>>
>>> the behaviour you describe sounds to me like you are using shortcuts,
>>> not real copies of elements.
>>> How do you create your copy?
>>> Select -> <Ctrl> + <C> -> <Ctrl> + <V> ?
>>>
>>> Regards Thomas
>>>
>>> markitus schrieb:
>>>> Hi Thomas,
>>>>
>>>> I did exactly as you said (step 1). Actually it was already done
>>>> before I started trying to copy paste. I'm getting the same errors as
>>>> Tobias. If I change smth in the new copied element, whatever change I
>>>> do on this new element, is reflected on the original too. So there
>>>> must be some base errors that leads us to this behavior.
>>>>
>>>> I can't understand why it's behaving like this, and for sure I don't
>>>> want to give up ( I can't ), but it's really starting to be quite
>>>> discouraging. It seems so obvious that it should SIMPLY work...
>>>>
>>>> good to know, Tobias, that I'm not alone in this fight!
>>>>
>>>>
>>>> El dia Fri, 20 Feb 2009 17:12:12 +0100, en/na Thomas Beyer va
>>>> escriure:
>>>>
>>>>> Never give up, guys ;-)
>>>>>
>>>>> So first of all:
>>>>> Did you both make sure to use uuids for your semantic model as I
>>>>> described earlier in step 1?
>>>>>
>>>>> If so, copy paste should at least work for elements placed directly
>>>>> on the canvas.
>>>>>
>>>>> So you must add the following extension to your plugin-xml:
>>>>> <extension point="org.eclipse.emf.ecore.extension_parser">
>>>>> <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
>>>>>
class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
>>>>> </parser>
>>>>> </extension>
>>>>>
>>>>> Where MY_SEMANTIC_MODEL_FILE_EXTENSION seriously only is the
>>>>> file-extension of your editor-files.
>>>>>
>>>>> Step 2 was the solution to make copy/paste work in compartments
>>>>> (container-elements).
>>>>>
>>>>>
>>>>> Regards, Thomas
>>>>>
>>>>>
>>>>> Am 20.02.2009 16:06, schrieb Tobias:
>>>>>> Hello Marc,
>>>>>>
>>>>>> it seems you have the same problem I had (and still have). The
>>>>>> point is, that the elements do not disappear after they have been
>>>>>> copied, but that only their views are copied, I guesss. To verify
>>>>>> this, please copy-paste an element and then modify it. If I'm
>>>>>> right, the original element will get changed, too.
>>>>>>
>>>>>> However, this is not a solution to your problem (I wish it were, as
>>>>>> then my problem would be solved as well), but maybe it gives you
>>>>>> some idea of where to begin. For me, I tried a few days to solve it
>>>>>> before I finally gave up... :-(
>>>>>>
>>>>>> Regards, and good luck,
>>>>>> Tobias
>>>>>>
>>>>>>
>>>>>>
>>>>>> markitus schrieb:
>>>>>>> Hi Thomas,
>>>>>>>
>>>>>>> Perhaps I misunderstood or I missed something. But wouldn't the
>>>>>>> result be the same (or similar) if we extend
>>>>>>> AbstractClipboardSupport (which implements IClipboardSupport) and
>>>>>>> rewrite these methods? Anyway, I'm clearly confused, as you see.
>>>>>>> My problem is not pasting into compartments , I didn't even get
>>>>>>> that far yet :( . I've enabled the copy/Paste option so it shows
>>>>>>> up in the contextual menu. I'm being able to copy or paste
>>>>>>> whatever elements I want to(graphically), but when I try to make
>>>>>>> these changes persistent these new copied elements simply
>>>>>>> disappear. Even if I add an original object from the palette after
>>>>>>> a copy/paste action, the previously copied elements disappear from
>>>>>>> the canvas. It is so weird!!
>>>>>>>
>>>>>>> So I'm not sure if i have to rewrite anything since I'm not trying
>>>>>>> to do anything special, just a simple copy paste action with
>>>>>>> simple elements (not compartments).
>>>>>>> Should I expect this to work straight, or should I rewrite some
>>>>>>> code ?
>>>>>>>
>>>>>>> Thanks for your help.
>>>>>>>
>>>>>>> Marc.
>>>>>>>
>>>>>>> El dia Thu, 19 Feb 2009 19:22:49 +0100, en/na Thomas Beyer va
>>>>>>> escriure:
>>>>>>>
>>>>>>>> Hi Markitus,
>>>>>>>>
>>>>>>>> I really struggled a long time with cut, copy & paste, especially
>>>>>>>> pasting into compartments.
>>>>>>>>
>>>>>>>> From what I can tell, GMF provides everything you need and
>>>>>>>> implements a very powerful framework around copy-paste. If you
>>>>>>>> see all the related classes, its a quiet complex job. Marios
>>>>>>>> approach might also work for your use-case, unfortunately I never
>>>>>>>> got it working for my editors.
>>>>>>>>
>>>>>>>> There is just two little hints, I'd like to give you: 1. Make
>>>>>>>> sure to use uuids for your semantic model as described in this
>>>>>>>> post:
>>>>>>>> http://serdom.eu/ser/2008/07/02/eclipse-gmf-enabling-uuids-i n-
>>>> semantic-
>>>>>>> model-the-simplest-way
>>>>>>>> There are lots of others threats in this group, adressing exactly
>>>>>>>> this issue as well.
>>>>>>>>
>>>>>>>> 2. Fork the class NotationClipboardOperationHelper(in plugin
>>>>>>>> org.eclipse.gmf.runtime.notation.providers) and modify the
>>>>>>>> following methods:
>>>>>>>> a)
>>>>>>>> static EObject getSemanticPasteTarget(View view) { View parent =
>>>>>>>> (View) view.eContainer(); return
>>>>>>> parent.getElement();
>>>>>>>> }
>>>>>>>>
>>>>>>>> b)
>>>>>>>> private boolean shouldAllowPaste(
>>>>>>>> PasteChildOperation overriddenChildPasteOperation) { EObject
>>>>>>>> eObject = overriddenChildPasteOperation.getEObject(); EObject
>>>>>>>> parentEObject = overriddenChildPasteOperation
>>>>>>>> .getParentEObject(); //implement your logic here, that checks, if
>>>>>>>> eObject is allowed
>>>>>>> zo be
>>>>>>>> can be pasted in the parentEObject
>>>>>>>> }
>>>>>>>>
>>>>>>>> I got the clue from this page:
>>>>>>>> http://wiki.eclipse.org/
>> GMF_Newsgroup_Q_and_A#How_to_make_copy.2Fpaste_work_on_compa rtments.3F
>>>>>>>> , which contains so many useful solutions!!!
>>>>>>>>
>>>>>>>> Forking basically means, you import the plugin above from the
>>>>>>>> eclipse cvs base, modify the code and use your customized plugin
>>>>>>>> for your application, rcp or whatever. (just in case you struggle
>>>>>>>> with the term, like I used to)
>>>>>>>> Let me know, if you need any further help.
>>>>>>>>
>>>>>>>>
>>>>>>>> HTH
>>>>>>>> Regards,
>>>>>>>> Thomas
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> markitus schrieb:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm trying to copy and paste single elements from a model into a
>>>>>>>>> new model. Apparently it looks like it's done, since I can see a
>>>>>>>>> graphical copy of that element, but if I try to save the diagram
>>>>>>>>> and open it back it just disappears.
>>>>>>>>>
>>>>>>>>> any ideas?? this is starting to drive me crazy. I haven't been
>>>>>>>>> able to find any complete and clear example of a simple copy
>>>>>>>>> paste action on GMF. Many people has already asked this issue on
>>>>>>>>> this list before me but it seems like there aren't any
>>>>>>>>> convincing solution.
>>>>>>>>>
>>>>>>>>> Please, help!
>>>>>>>>>
>>>>>>>>> thank you!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>

Hi Daniel,

I'm afraid I don't have good news for you. I just gave it up. I didn't
get any closer, I tried to update all the emf/gmf plugins but it didn't
work out after all. I'm sorry.

I'm just back here to find a solution but it looks like i was the last
one asking about this. I spent a great amount of time attempting to
copy / paste but I didn't even take a single step forward. I don't want
to discourage you but I wouldn't waste much time with this.

anyway, good luck!! and of course, if you manage to solve it, tell me
how! ;)

cheers,

marc.
Previous Topic:Scrolling Compartment EditParts using Mouse Wheel
Next Topic:save as
Goto Forum:
  


Current Time: Sat Nov 18 10:32:10 GMT 2017

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

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