Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Element id
Element id [message #877490] Sat, 26 May 2012 21:26 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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 Go to previous message
Eclipse UserFriend
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
Previous Topic:packageImport
Next Topic:[TENEO/CDO] Reverse engineer a JPA annotated Pojo model
Goto Forum:
  


Current Time: Fri Apr 26 09:45:14 GMT 2024

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

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

Back to the top