What is the best way to enumerate contents of instance file ? [message #55086] |
Mon, 19 December 2005 16:37 |
Eclipse User |
|
|
|
Originally posted by: thf20022003.yahoo.com
Assuming that I have an instance file "instance.xmi" created from the
metamodel "company.ecore".
After I load "instance.xmi" using Resource, I enumerate the contents of
"instance.xmi" by using the following code:
EList eList = resource.getContents();
for (int i=0; i<eList.size(); ++i) {
if ( eList.get(i) instanceof EPackage) {
} else if ( eList.get(i) instanceof EClass) {
} else if ( eList.get(i) instanceof EObject) {
// Always come here
} else {
}
}
I always get "eList.get(i) instanceof EObject".
Is there any way to get an instance of the "class" in company.ecore
metamodel ?
Regards,
Tong
|
|
|
Re: What is the best way to enumerate contents of instance file ? [message #55112 is a reply to message #55086] |
Mon, 19 December 2005 16:40 |
Eclipse User |
|
|
|
Originally posted by: thf20022003.yahoo.com
Hi,
Sorry. Wrong newsgroup (I intend to post in emf).
Regards,
"Tong" <thf20022003@yahoo.com> wrote in message
news:do6nkb$b7d$1@utils.eclipse.org...
> Assuming that I have an instance file "instance.xmi" created from the
> metamodel "company.ecore".
> After I load "instance.xmi" using Resource, I enumerate the contents of
> "instance.xmi" by using the following code:
> EList eList = resource.getContents();
> for (int i=0; i<eList.size(); ++i) {
> if ( eList.get(i) instanceof EPackage) {
> } else if ( eList.get(i) instanceof EClass) {
>
> } else if ( eList.get(i) instanceof EObject) {
> // Always come here
> } else {
>
> }
> }
> I always get "eList.get(i) instanceof EObject".
> Is there any way to get an instance of the "class" in company.ecore
> metamodel ?
>
> Regards,
> Tong
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03637 seconds