Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Moving referenced model / how to update it programmitcally
Moving referenced model / how to update it programmitcally [message #484380] Mon, 07 September 2009 10:21 Go to next message
Eclipse UserFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Divide Properties into Categories
Next Topic:How to be notified of an EList change
Goto Forum:
  


Current Time: Wed Apr 24 14:00:36 GMT 2024

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

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

Back to the top