Element id [message #877490] |
Sat, 26 May 2012 21:26 |
Eclipse User |
|
|
|
Hello,
is it possible to retrieve xmi:id of the element after resource is loaded?
Regards,
Emil
|
|
|
Re: Element id [message #877494 is a reply to message #877490] |
Sat, 26 May 2012 21:32 |
|
Hi, Emil,
The XMLResource has a getID(EObject) method that provides this, if you have
an XMI resource that uses IDs.
HTH,
Christian
Emil Huseynli <emilhuseynli@xxxxxxxx> wrote:
> Hello,
>
> is it possible to retrieve xmi:id of the element after resource is loaded?
>
> Regards,
> Emil
|
|
|
Re: Element id [message #877496 is a reply to message #877494] |
Sat, 26 May 2012 21:38 |
Eclipse User |
|
|
|
thanks! and if someone ever need, here is a helper method for retrieving id
(taken from
http://www.openarchitectureware.org/forum/viewtopic.php?showtopic=14710)
public static String getXmiId(EObject x) {
Resource resource = x.eResource();
if (resource instanceof XMLResource) {
XMLResource xmlResource = (XMLResource)resource;
return xmlResource.getID(x);
}
return "";
}
On 26.05.2012 23:32, Christian W. Damus wrote:
> Hi, Emil,
>
> The XMLResource has a getID(EObject) method that provides this, if you have
> an XMI resource that uses IDs.
>
> HTH,
>
> Christian
>
>
> Emil Huseynli<emilhuseynli@xxxxxxxx> wrote:
>> Hello,
>>
>> is it possible to retrieve xmi:id of the element after resource is loaded?
>>
>> Regards,
>> Emil
|
|
|
Powered by
FUDForum. Page generated in 0.02967 seconds