Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » What is the best way to enumerate contents of instance file ?
What is the best way to enumerate contents of instance file ? [message #55086] Mon, 19 December 2005 16:37 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:Stand alone tutorial
Next Topic:Recommendations for provider id when using the equinox extension registry
Goto Forum:
  


Current Time: Fri Jul 12 08:49:21 GMT 2024

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

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

Back to the top