Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EPackage.getEClassifiers() EList order
EPackage.getEClassifiers() EList order [message #417590] Sun, 16 March 2008 12:05 Go to next message
Eclipse UserFriend
Originally posted by: felix.mueller.snafu.de

Hello EMF Gurus,

is it safe to assume that, unless I manually manipulate the list, the
position of an EClassifier in the EList returned by
EPackage.getEClassifiers() equals the int meta object id in the package
generated from my ecore model?

Or is it advisable to use a different method
(e.g. getEClassifier(String) or iterating through the result...) to
dynamically get an EClassifier for a (simple) ID?

Thanks,

--
Felix Müller
Re: EPackage.getEClassifiers() EList order [message #417599 is a reply to message #417590] Mon, 17 March 2008 01:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Felix,

Yes the need to match. Note however that when you generate a model,
the order of the classifiers in the generated package is not the same as
the order in the original EPackage instance from which you generated
it. Maybe I should ask what kind of code you are writing to be sure
that using IDs in a good way...


Felix Mueller wrote:
> Hello EMF Gurus,
>
> is it safe to assume that, unless I manually manipulate the list, the
> position of an EClassifier in the EList returned by
> EPackage.getEClassifiers() equals the int meta object id in the package
> generated from my ecore model?
>
> Or is it advisable to use a different method
> (e.g. getEClassifier(String) or iterating through the result...) to
> dynamically get an EClassifier for a (simple) ID?
>
> Thanks,
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EPackage.getEClassifiers() EList order [message #417619 is a reply to message #417599] Tue, 18 March 2008 12:02 Go to previous message
Eclipse UserFriend
Originally posted by: felix.mueller.snafu.de

Hello Ed,

* Ed Merks -- [2008-03-17] writes:
> Felix Mueller wrote:
>> is it safe to assume that, unless I manually manipulate the list, the
>> position of an EClassifier in the EList returned by
>> EPackage.getEClassifiers() equals the int meta object id in the package
>> generated from my ecore model?
>
> Yes the need to match.

Thanks.

> Maybe I should ask what kind of code you are writing to be sure that
> using IDs in a good way...

Better not! :-) It involves some evil initialization ...

I was looking for a "cheap" way to restrict feasible assignments for
typed features in the generated EMF editor (as mentioned before,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=192687 , when used
reflectively, at most ERawType is respected). Using the ID to reference
the right EClassifier seemed like a pragmatic solution.

Meanwhile, I have adjusted my ItemProvider template to check whether
the class has type parameters and generate custom
ItemPropertyDescriptors for the relevant features. In this course, the
eContainingFeature is queried for TypeArguments, which in turn can be
used for constructing an argument for getReachableObjectsOfType. This is
ugly, too, but works OK for my model.

So, no IDs involved, anymore, right now; but it's good to know this
should work, too. Thanks!

--
Felix Müller
Previous Topic:XML-Schema-to-whatever-mapping
Next Topic:How to programmatically resolve a proxy?
Goto Forum:
  


Current Time: Fri Apr 19 17:01:22 GMT 2024

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

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

Back to the top