Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Copy/Paste tutorial
Copy/Paste tutorial [message #180955] Fri, 04 April 2008 14:18 Go to next message
BLANC Philippe is currently offline BLANC PhilippeFriend
Messages: 89
Registered: July 2009
Member
Hi,

Can somebody explain how to implement copy/paste functionality with GMF
generated diagram?

I tried this tutorial : http://serdom.szn.pl/ser/?p=6, but it fails.
When I paste a top node, a figure is displayed with a description of the
copied object between []. Do I have to add some properties to my Ecore
model ?

It seems that Logic example implements copy/paste, but domain model and
diagram are same file.

If somebody can describe step by step how to do this, it would be very
helpful for me.

Thank you very much !

Best regards,

Philippe
Re: Copy/Paste tutorial [message #180972 is a reply to message #180955] Fri, 04 April 2008 14:41 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Philippe,

To work around the problems with Copy/Paste you have to turn on "useUUIDs"
properties in the Resource implementation used for storing/loading your domain
model. One of the possible solution - use GMFResourceFactory for loading/saving
your domain model file.

-----------------
Alex Shatalin
Re: Copy/Paste tutorial [message #180980 is a reply to message #180972] Fri, 04 April 2008 15:06 Go to previous messageGo to next message
BLANC Philippe is currently offline BLANC PhilippeFriend
Messages: 89
Registered: July 2009
Member
Hi Alex,
How can I do that ? Can you explain me how to do this ? or give me an
url/source code ?

Thanks !

Alex Shatalin a écrit :
> Hello Philippe,
>
> To work around the problems with Copy/Paste you have to turn on
> "useUUIDs" properties in the Resource implementation used for
> storing/loading your domain model. One of the possible solution - use
> GMFResourceFactory for loading/saving your domain model file.
>
> -----------------
> Alex Shatalin
>
>
Re: Copy/Paste tutorial [message #181156 is a reply to message #180972] Mon, 07 April 2008 12:40 Go to previous messageGo to next message
BLANC Philippe is currently offline BLANC PhilippeFriend
Messages: 89
Registered: July 2009
Member
Ok, I found the answer. Here is the correct procedure :

1. In your .genmodel file, set the parameter "Resource Type" to XMI.

2. Generate the source code

3. In the generated class named $MyModel$ResourceImpl (in the package
$MyPlgin$.util), you override the method "useUUIDs" like below

/**
* @generated NOT
*/
@Override
protected boolean useUUIDs() {
return true;
}

4. Generate all code (from your .gmfgen file)
5. Check if you have an extension of
org.eclipse.emf.ecore.extension_parser in your generated plugin.xml like
below :


<extension point="org.eclipse.emf.ecore.extension_parser">
<?gmfgen generated="true"?>
<parser
type="$MyDiagramNameFile$"

class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
</parser>
</extension>
Re: Copy/Paste tutorial [message #181196 is a reply to message #181156] Mon, 07 April 2008 14:21 Go to previous message
Eclipse UserFriend
Originally posted by: taggartboy.hotmail.com

Hi,

I implemented the steps in the previous post but still have a few issues
with the copy/paste.

1. The copy/paste does not work in an RCP application

2. in a non-RCP application the copy/pase functionallity allows the
diagram to be broken and exhibits strange behaviour: if i copy an element
that can exist only as a child of another element, i can paste it outside
the parent. This copy is non-unique and appears to be another
representation of the element you copied (any properties changed on either
propagate on both) but should NOT be allowed to be created in the first
place.

If anyone can please provide help on either of the above it would be
greatly appreciated,

Thanks
peter.
Previous Topic:Re-order children in compartment
Next Topic:Hyperedges with Junction points (just) in Notation Model
Goto Forum:
  


Current Time: Tue Aug 27 23:29:33 GMT 2024

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

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

Back to the top