[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.emf] Re: [DanglingHREF]How to save while there is a DanglingHREF
|
Joseph,
You could use EcoreUtil.ExternalCrossReferencer (or some variation that checks
for eResource being null) to find your dangling references and perform some kind
of fixup action (replace/remove), or you could use
XMLResource.OPTION_PROCESS_DANGLING_HREF set to
OPTION_PROCESS_DANGLING_HREF_DISCARD to discard them on save.
Joseph Khalil wrote:
> Hi all
> I have this problem with Dangling hrefrences.
>
> In my situation i have:
> a resource (res1) which contain eobject(parent1) which compose a child
> (child1) , and i edit it with editor (editor1)
> a resource (res2) which contain eobject(parent2) which compose a child
> (child2) , and i edit it with editor (editor2)
> and child 2 refers to child 1 with a uni-directional
> reference(set/getOtherChild methods).
>
> now , i open the application :
> -from editor2: i resolved child1 (i called child2.getOtherChild() )
> -from editor1: , i deleted child1 from parent 1 and saved resource1 ,
> -from editor2: i triesd to save resource 2 , i got a DanglingHREFException ,
> because child2.getOtherChild() (which is child1 ) is not contained in a
> resource.
>
> note: i tried the same scenario but i didn't resolve child1 ( i didn't call
> child2.getOtherChild() from editor2) , and i could save resource 2 ,and when
> i opened the application later , and opened editor2 , i couldn't resolve
> child2.getOtherChild() ( child2.getOtherChild().eIsProxy() returns true) ,
> and this is normal ofcource because child1 was deleted.
>
> my question is , in the first scenario , how could i save resource 2 after i
> already resolved child1 , can i force child 2 to make its reference to child
> 1 as proxy (using child2.getOtherChild().eSetProxyUri(uri)) , and try to
> obtain the previous uri of child1 before it was deleted , the problem that i
> couldn't obtain such uri , and i guess it's natural , because the object
> fragment in the uri describes the path of the object in the resource, and
> how this be retrieved after it was already deleted from the resource...
>
> any help is appreciated
>
> Thanks
> Joe