Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » copy and paste bug?
copy and paste bug? [message #171371] Tue, 05 February 2008 07:50 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

following the tutorial (first part) and running the generated diagram
editor I noticed that copy & paste has some problems: a node can be
copied and pasted, but the pasted copy does not allow you to modify the
label (and the label is not actually copied); but most of all, you
cannot add new objects to the diagram, and the underlying model is
irreversibly ruined: it is basically emptied...

anyone else noticed this?

Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: copy and paste bug? [message #171482 is a reply to message #171371] Tue, 05 February 2008 12:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Lorenzo,

Are you using UUIDs in your diagram and model resources? This is a
pre-requisite of the copy/paste infrastructure in GMF Run-time.

HTH,

Christian

Lorenzo Bettini wrote:

> Hi
>
> following the tutorial (first part) and running the generated diagram
> editor I noticed that copy & paste has some problems: a node can be
> copied and pasted, but the pasted copy does not allow you to modify the
> label (and the label is not actually copied); but most of all, you
> cannot add new objects to the diagram, and the underlying model is
> irreversibly ruined: it is basically emptied...
>
> anyone else noticed this?
>
> Lorenzo
>
Re: copy and paste bug? [message #171605 is a reply to message #171482] Tue, 05 February 2008 20:00 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi Christian

apologies for my ignorance: what are UUIDs? I've actually used the
diagram generated following the GMF tutorial (part I)...

thanks in advance
Lorenzo

Christian W. Damus wrote:
> Hi, Lorenzo,
>
> Are you using UUIDs in your diagram and model resources? This is a
> pre-requisite of the copy/paste infrastructure in GMF Run-time.
>
> HTH,
>
> Christian
>
> Lorenzo Bettini wrote:
>
>> Hi
>>
>> following the tutorial (first part) and running the generated diagram
>> editor I noticed that copy & paste has some problems: a node can be
>> copied and pasted, but the pasted copy does not allow you to modify the
>> label (and the label is not actually copied); but most of all, you
>> cannot add new objects to the diagram, and the underlying model is
>> irreversibly ruined: it is basically emptied...
>>
>> anyone else noticed this?
>>
>> Lorenzo
>>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: copy and paste bug? [message #171987 is a reply to message #171371] Sat, 09 February 2008 20:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gxquarel.txin.it

I have a similar problem with copy and paste: I can paste node even where
the model shouldn't have such a node. In fact in the semantic portion of my
file doesn't contain the related object only present in the notation part.
Maybe a problem with some edit policies?
Ciao

Giovanni


"Lorenzo Bettini" <bettini@dsi.unifi.it> ha scritto nel messaggio
news:fo94fv$hfn$1@build.eclipse.org...
> Hi
>
> following the tutorial (first part) and running the generated diagram
> editor I noticed that copy & paste has some problems: a node can be copied
> and pasted, but the pasted copy does not allow you to modify the label
> (and the label is not actually copied); but most of all, you cannot add
> new objects to the diagram, and the underlying model is irreversibly
> ruined: it is basically emptied...
>
> anyone else noticed this?
>
> Lorenzo
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
> HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
> http://www.myspace.com/supertrouperabba
> BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
> http://www.gnu.org/software/src-highlite
> http://www.gnu.org/software/gengetopt
> http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: copy and paste bug? [message #172143 is a reply to message #171605] Mon, 11 February 2008 14:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Lorenzo,

UUIDs are the (pseudo-)universally unique identifiers generated by EMF when
an XMLResourceImpl implements useUUIDs() to return true. See
EcoreUtil::generateUUID() for details.

Cheers,

Christian


Lorenzo Bettini wrote:

> Hi Christian
>
> apologies for my ignorance: what are UUIDs? I've actually used the
> diagram generated following the GMF tutorial (part I)...
>
> thanks in advance
> Lorenzo
>
> Christian W. Damus wrote:
>> Hi, Lorenzo,
>>
>> Are you using UUIDs in your diagram and model resources? This is a
>> pre-requisite of the copy/paste infrastructure in GMF Run-time.
>>
>> HTH,
>>
>> Christian
>>
>> Lorenzo Bettini wrote:
>>
>>> Hi
>>>
>>> following the tutorial (first part) and running the generated diagram
>>> editor I noticed that copy & paste has some problems: a node can be
>>> copied and pasted, but the pasted copy does not allow you to modify the
>>> label (and the label is not actually copied); but most of all, you
>>> cannot add new objects to the diagram, and the underlying model is
>>> irreversibly ruined: it is basically emptied...
>>>
>>> anyone else noticed this?
>>>
>>> Lorenzo
>>>
>>
>
>
Re: copy and paste bug? [message #172220 is a reply to message #172143] Mon, 11 February 2008 18:36 Go to previous messageGo to next message
John Yotka is currently offline John YotkaFriend
Messages: 144
Registered: July 2009
Senior Member
Christian W. Damus wrote:
> Hi, Lorenzo,
>
> UUIDs are the (pseudo-)universally unique identifiers generated by EMF when
> an XMLResourceImpl implements useUUIDs() to return true. See
> EcoreUtil::generateUUID() for details.
>
> Cheers,
>
> Christian
>
>
> Lorenzo Bettini wrote:
>
>> Hi Christian
>>
>> apologies for my ignorance: what are UUIDs? I've actually used the
>> diagram generated following the GMF tutorial (part I)...
>>
>> thanks in advance
>> Lorenzo
>>
>> Christian W. Damus wrote:
>>> Hi, Lorenzo,
>>>
>>> Are you using UUIDs in your diagram and model resources? This is a
>>> pre-requisite of the copy/paste infrastructure in GMF Run-time.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>> Lorenzo Bettini wrote:
>>>
>>>> Hi
>>>>
>>>> following the tutorial (first part) and running the generated diagram
>>>> editor I noticed that copy & paste has some problems: a node can be
>>>> copied and pasted, but the pasted copy does not allow you to modify the
>>>> label (and the label is not actually copied); but most of all, you
>>>> cannot add new objects to the diagram, and the underlying model is
>>>> irreversibly ruined: it is basically emptied...
>>>>
>>>> anyone else noticed this?
>>>>
>>>> Lorenzo
>>>>
>>
>
Christian,

I just overrode the useUUIDs() to return true, ran my EMF editor and
created a new root object. But when the editor tried to open the new
resource file it complains about the "id" feature with a
FeatureNotFoundException: Feature 'id' not found. The 'id' feature
looks like the UUID. What else do I need to do?
Re: copy and paste bug? [message #172227 is a reply to message #172220] Mon, 11 February 2008 21:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, john,

I think you also need useIDs() to return true, otherwise the resource will
look in each EClass for an EAttribute that has isID set.

HTH,

Christian

John Yotka wrote:

> Christian W. Damus wrote:
>> Hi, Lorenzo,
>>
>> UUIDs are the (pseudo-)universally unique identifiers generated by EMF
>> when
>> an XMLResourceImpl implements useUUIDs() to return true. See
>> EcoreUtil::generateUUID() for details.
>>
>> Cheers,
>>
>> Christian
>>
>>

-----8<-----

> I just overrode the useUUIDs() to return true, ran my EMF editor and
> created a new root object. But when the editor tried to open the new
> resource file it complains about the "id" feature with a
> FeatureNotFoundException: Feature 'id' not found. The 'id' feature
> looks like the UUID. What else do I need to do?
Re: copy and paste bug? [message #172233 is a reply to message #172227] Mon, 11 February 2008 22:17 Go to previous messageGo to next message
John Yotka is currently offline John YotkaFriend
Messages: 144
Registered: July 2009
Senior Member
Christian W. Damus wrote:
> Hi, john,
>
> I think you also need useIDs() to return true, otherwise the resource will
> look in each EClass for an EAttribute that has isID set.
>
> HTH,
>
> Christian
>
> John Yotka wrote:
>
>> Christian W. Damus wrote:
>>> Hi, Lorenzo,
>>>
>>> UUIDs are the (pseudo-)universally unique identifiers generated by EMF
>>> when
>>> an XMLResourceImpl implements useUUIDs() to return true. See
>>> EcoreUtil::generateUUID() for details.
>>>
>>> Cheers,
>>>
>>> Christian
>>>
>>>
>
> -----8<-----
>
>> I just overrode the useUUIDs() to return true, ran my EMF editor and
>> created a new root object. But when the editor tried to open the new
>> resource file it complains about the "id" feature with a
>> FeatureNotFoundException: Feature 'id' not found. The 'id' feature
>> looks like the UUID. What else do I need to do?
>
Christian,

I have now overridden both useUUIDs() and useIDs() to return true, and
got the same behavior. All of the objects in the resource file have an
'id' attribute that is set to a (psuedo-)UUID.

When the EMF editor tries to load the resource, I get the exception:

FeatureNotFoundException: Feature 'id' not found.

for every object in the resource.
Re: copy and paste bug? [message #172249 is a reply to message #172233] Tue, 12 February 2008 02:25 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi John,

Actually, you don't need to override useIDs(), since the XMLResourceImpl
implementation already returns true if useUUIDs() does.

There is, however, one additional step required to make the loader
recognize the extrinsic id attribute. This happens by default in
XMIResourceImpl, which is where such IDs are normally used. But, with
the XMLResourceImpl, you need to specify it via the XMLMap option.

This createResource() implementation, which you could put in a custom
Resource.Factory, should be sufficient to create an UUID-enabled
XMLResourceImpl:

public Resource createResource(URI uri)
{
XMLResource result = new XMLResourceImpl(uri)
{
protected boolean useUUIDs()
{
return true;
}
};
XMLResource.XMLMap map = new XMLMapImpl();
map.setIDAttributeName("id");
result.getDefaultLoadOptions().put(XMLResource.OPTION_XML_MA P, map);
return result;
}

Cheers,
Dave


John Yotka wrote:
> Christian W. Damus wrote:
>> Hi, john,
>>
>> I think you also need useIDs() to return true, otherwise the resource
>> will
>> look in each EClass for an EAttribute that has isID set.
>>
>> HTH,
>>
>> Christian
>>
>> John Yotka wrote:
>>
>>> Christian W. Damus wrote:
>>>> Hi, Lorenzo,
>>>>
>>>> UUIDs are the (pseudo-)universally unique identifiers generated by EMF
>>>> when
>>>> an XMLResourceImpl implements useUUIDs() to return true. See
>>>> EcoreUtil::generateUUID() for details.
>>>>
>>>> Cheers,
>>>>
>>>> Christian
>>>>
>>>>
>>
>> -----8<-----
>>
>>> I just overrode the useUUIDs() to return true, ran my EMF editor and
>>> created a new root object. But when the editor tried to open the new
>>> resource file it complains about the "id" feature with a
>>> FeatureNotFoundException: Feature 'id' not found. The 'id' feature
>>> looks like the UUID. What else do I need to do?
>>
> Christian,
>
> I have now overridden both useUUIDs() and useIDs() to return true, and
> got the same behavior. All of the objects in the resource file have an
> 'id' attribute that is set to a (psuedo-)UUID.
>
> When the EMF editor tries to load the resource, I get the exception:
>
> FeatureNotFoundException: Feature 'id' not found.
>
> for every object in the resource.
Re: copy and paste bug? [message #172707 is a reply to message #172249] Sat, 16 February 2008 17:40 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Dave Steinberg wrote:
> Hi John,
>
> Actually, you don't need to override useIDs(), since the XMLResourceImpl
> implementation already returns true if useUUIDs() does.
>
> There is, however, one additional step required to make the loader
> recognize the extrinsic id attribute. This happens by default in
> XMIResourceImpl, which is where such IDs are normally used. But, with
> the XMLResourceImpl, you need to specify it via the XMLMap option.
>
> This createResource() implementation, which you could put in a custom
> Resource.Factory, should be sufficient to create an UUID-enabled
> XMLResourceImpl:
>
> public Resource createResource(URI uri)
> {
> XMLResource result = new XMLResourceImpl(uri)
> {
> protected boolean useUUIDs()
> {
> return true;
> }
> };
> XMLResource.XMLMap map = new XMLMapImpl();
> map.setIDAttributeName("id");
> result.getDefaultLoadOptions().put(XMLResource.OPTION_XML_MA P, map);
> return result;
> }
>

I still haven't tried this solution, but shouldn't this be the default
at least when using GMF generated editors? I mean it's quite natural to
expect copy and paste to work, isn't it?

Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: copy and paste bug? [message #173009 is a reply to message #172707] Tue, 19 February 2008 18:52 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Lorenzo Bettini wrote:
>
> I still haven't tried this solution, but shouldn't this be the default
> at least when using GMF generated editors? I mean it's quite natural to
> expect copy and paste to work, isn't it?

Ho Lorenzo,

I agree. If IDs are required, then GMF should be defaulting to an XMI
resource implementation with UUIDs enabled. I suppose that if they're
relying on EMF's default code generation, this isn't the case?

Cheers,
Dave
Re: copy and paste bug? [message #173213 is a reply to message #173009] Wed, 20 February 2008 18:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Dave,

I believe that GMF does define a resource impl that does this. But of
course you have to be sure you're using that too...


Dave Steinberg wrote:
> Lorenzo Bettini wrote:
>>
>> I still haven't tried this solution, but shouldn't this be the
>> default at least when using GMF generated editors? I mean it's quite
>> natural to expect copy and paste to work, isn't it?
>
> Ho Lorenzo,
>
> I agree. If IDs are required, then GMF should be defaulting to an XMI
> resource implementation with UUIDs enabled. I suppose that if they're
> relying on EMF's default code generation, this isn't the case?
>
> Cheers,
> Dave
Re: copy and paste bug? [message #185187 is a reply to message #173213] Sun, 04 May 2008 13:09 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Sorry for the long silence about this issue...

I've just noticed that setting the same file for the model and the
diagram does not show this problem...


Re: copy and paste bug? [message #185195 is a reply to message #185187] Sun, 04 May 2008 13:27 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Lorenzo,

It's not surprising considering that the GMF resource has UUIDs enabled.


Lorenzo Bettini wrote:
> Sorry for the long silence about this issue...
>
> I've just noticed that setting the same file for the model and the
> diagram does not show this problem...
Previous Topic:Excluding lines from a @generated - marked block
Next Topic:[Announce] GMF 2.1.0 I200805040007 is available
Goto Forum:
  


Current Time: Fri Apr 26 06:52:26 GMT 2024

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

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

Back to the top