Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsWhat is the best way to enumerate contents of instance file ?
https://www.eclipse.org/forums/index.php/mv/msg/17190/55086/#msg_55086
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]]>2005-12-19T16:37:30-00:00Re: What is the best way to enumerate contents of instance file ?
https://www.eclipse.org/forums/index.php/mv/msg/17190/55112/#msg_55112
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
>
>]]>2005-12-19T16:40:19-00:00