EPackage.getEClassifiers() EList order [message #417590] |
Sun, 16 March 2008 12:05 |
Eclipse User |
|
|
|
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 #417619 is a reply to message #417599] |
Tue, 18 March 2008 12:02 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.01722 seconds