Home » Modeling » UML2 » Reference Updating
|
Re: Reference Updating [message #474864 is a reply to message #474755] |
Wed, 01 August 2007 19:50 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Andrew,
I think a question like this was asked before - did you search the newsgroup
history?
Code that does something similar to this already exists in UML2 - take a
look at
org.eclipse.uml2.uml.resource.UML22UMLResoureHandler#reincar nate(...). This
method a) creates a new instance of the same or similar type, b) sets the
identifier for the new instance to be the same as the original, c) copies
the values of all of the features on the original element to the new
element, and d) redirects all known references to the original element to
the new element...
Kenn
"Andrew Carton" <cartona@cs.tcd.ie> wrote in message
news:f8ppjv$jot$1@build.eclipse.org...
> Hi,
>
> Imagine one has an UML Element 'A', and many unknown UML Elements that
> reference this element. Given another uml element 'B' of the same type as
> A, I'd like to force all the references that point to A to now point to B.
> Also, B may contain its own references that I'd also like to keep intact,
> so simply replacing the instance of the Ecore properties of element B with
> those of A and re-adding a copy of A to the model will not work.
>
> Is there any generic easy way of doing this? Perhaps using the EMF
> reflection maybe?
>
> Cheers,
> Andrew.
|
|
|
Re: Reference Updating [message #474866 is a reply to message #474864] |
Thu, 02 August 2007 11:05 |
Andrew Carton Messages: 104 Registered: July 2009 |
Senior Member |
|
|
Thats great, thanks Kenn. Sorry I didn't realise someone posted this
before, I thought the problem was too specific.
Andrew.
Ar 01/08/2007 20:50, Scríobh Kenn Hussey:
> Andrew,
>
> I think a question like this was asked before - did you search the newsgroup
> history?
>
> Code that does something similar to this already exists in UML2 - take a
> look at
> org.eclipse.uml2.uml.resource.UML22UMLResoureHandler#reincar nate(...). This
> method a) creates a new instance of the same or similar type, b) sets the
> identifier for the new instance to be the same as the original, c) copies
> the values of all of the features on the original element to the new
> element, and d) redirects all known references to the original element to
> the new element...
>
> Kenn
>
> "Andrew Carton" <cartona@cs.tcd.ie> wrote in message
> news:f8ppjv$jot$1@build.eclipse.org...
>> Hi,
>>
>> Imagine one has an UML Element 'A', and many unknown UML Elements that
>> reference this element. Given another uml element 'B' of the same type as
>> A, I'd like to force all the references that point to A to now point to B.
>> Also, B may contain its own references that I'd also like to keep intact,
>> so simply replacing the instance of the Ecore properties of element B with
>> those of A and re-adding a copy of A to the model will not work.
>>
>> Is there any generic easy way of doing this? Perhaps using the EMF
>> reflection maybe?
>>
>> Cheers,
>> Andrew.
>
>
|
|
|
Re: Reference Updating [message #624159 is a reply to message #474755] |
Wed, 01 August 2007 19:50 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Andrew,
I think a question like this was asked before - did you search the newsgroup
history?
Code that does something similar to this already exists in UML2 - take a
look at
org.eclipse.uml2.uml.resource.UML22UMLResoureHandler#reincar nate(...). This
method a) creates a new instance of the same or similar type, b) sets the
identifier for the new instance to be the same as the original, c) copies
the values of all of the features on the original element to the new
element, and d) redirects all known references to the original element to
the new element...
Kenn
"Andrew Carton" <cartona@cs.tcd.ie> wrote in message
news:f8ppjv$jot$1@build.eclipse.org...
> Hi,
>
> Imagine one has an UML Element 'A', and many unknown UML Elements that
> reference this element. Given another uml element 'B' of the same type as
> A, I'd like to force all the references that point to A to now point to B.
> Also, B may contain its own references that I'd also like to keep intact,
> so simply replacing the instance of the Ecore properties of element B with
> those of A and re-adding a copy of A to the model will not work.
>
> Is there any generic easy way of doing this? Perhaps using the EMF
> reflection maybe?
>
> Cheers,
> Andrew.
|
|
|
Re: Reference Updating [message #624161 is a reply to message #474864] |
Thu, 02 August 2007 11:05 |
Andrew Carton Messages: 104 Registered: July 2009 |
Senior Member |
|
|
Thats great, thanks Kenn. Sorry I didn't realise someone posted this
before, I thought the problem was too specific.
Andrew.
Ar 01/08/2007 20:50, Scríobh Kenn Hussey:
> Andrew,
>
> I think a question like this was asked before - did you search the newsgroup
> history?
>
> Code that does something similar to this already exists in UML2 - take a
> look at
> org.eclipse.uml2.uml.resource.UML22UMLResoureHandler#reincar nate(...). This
> method a) creates a new instance of the same or similar type, b) sets the
> identifier for the new instance to be the same as the original, c) copies
> the values of all of the features on the original element to the new
> element, and d) redirects all known references to the original element to
> the new element...
>
> Kenn
>
> "Andrew Carton" <cartona@cs.tcd.ie> wrote in message
> news:f8ppjv$jot$1@build.eclipse.org...
>> Hi,
>>
>> Imagine one has an UML Element 'A', and many unknown UML Elements that
>> reference this element. Given another uml element 'B' of the same type as
>> A, I'd like to force all the references that point to A to now point to B.
>> Also, B may contain its own references that I'd also like to keep intact,
>> so simply replacing the instance of the Ecore properties of element B with
>> those of A and re-adding a copy of A to the model will not work.
>>
>> Is there any generic easy way of doing this? Perhaps using the EMF
>> reflection maybe?
>>
>> Cheers,
>> Andrew.
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 04:51:12 GMT 2024
Powered by FUDForum. Page generated in 0.03046 seconds
|