Moving referenced model / how to update it programmitcally [message #484380] |
Mon, 07 September 2009 10:21 |
Eclipse User |
|
|
|
Originally posted by: jack.glass.gmx.com
Hi,
I have a model A (=mymodel.model) which is getting references by another
model B. The user can now move mymodel.model lets say in a subfolder
(sub). After this the referencing cannot be correctly resolved.
How can I programmatically update the reference?
Basically I want to show the user a dialog were he can choose the model
and than I would update the location of the unresolved references.
Before the moving it looks like
href="mymodel.model#//@root/@attributes.0"
after this I want to have
href="sub/mymodel.model#//@root/@attributes.0"
I want only to update the path before the #// part, everything after #//
should be as it was.
Regards,
Jack
|
|
|
Re: Moving referenced model / how to update it programmitcally [message #484441 is a reply to message #484380] |
Mon, 07 September 2009 13:23 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Jac,
Comments below.
Jack Glass wrote:
> Hi,
>
> I have a model A (=mymodel.model) which is getting references by
> another model B. The user can now move mymodel.model lets say in a
> subfolder (sub). After this the referencing cannot be correctly resolved.
>
> How can I programmatically update the reference?
Load the resource, ensure that all proxies are resolved, and then save it.
> Basically I want to show the user a dialog were he can choose the
> model and than I would update the location of the unresolved references.
EcoreUtil.UnresolveProxyCrossReferencer will help with that.
>
> Before the moving it looks like
> href="mymodel.model#//@root/@attributes.0"
>
> after this I want to have
> href="sub/mymodel.model#//@root/@attributes.0"
>
> I want only to update the path before the #// part, everything after
> #// should be as it was.
You can cast to InternalEObject to access the eProxyURI of these broken
links and even use eSetProxyURI to repair them.
>
> Regards,
> Jack
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03081 seconds