[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.ocl] Re: How to check the types of containment?
|
Hi Christian,
thanks for your patience
>
> But, you said in your post that you were getting error messages from
> expressions and "activated level M1" etc. If you weren't doing this in
> the OCL interpreter example (the "interactive console") then I don't
> know what you were using. AFAIK, the only UI that uses labels like "M2"
> and "M1" is that example.
I was doing it in the console but I'm not using the example.
>
> The MDT OCL SDK provides a "New Example" wizard that creates the
> interpreter/console example as a source project in your workspace. You
> can edit the code to customize the parser behaviour, if you need to, as
> in this case.
Ok thanks for the hint with the wizard. I will have a look. But at the
moment I don't need any code for running OCL statements or so. I just
need a way for developing some ocl expressions for my meta model. After
creating correct expressions I want to add them as EAnnotations on my
meta model elements in hope that the bug 255786 [1] will be solved soon.
And therefore I thought that I can use the OCL console just to see if
the expressions are correct - not more. And that's why I don't
understand why I have to switch M2 and M1 if I want to get code
completion in the console for this element or for that element. Thought
when I develop a new ecore meta model I am on the M2 level because it's
a meta model for my DSL.
> No, this snippet pertains to the UML metamodel. In UML models you can
> use allOwnedElements because it is defined by the uml::Element
> metaclass.
Ok I assumed that.
> self.exportedEvents ->forAll(ev |
> ev->closure(eContainer())->contains(self))
>
Neither on level M1 nor M2 the code assist shows me the closure(..) on
ev. The same with contains(..). And if I let this expression interprete
by the console in level M1 I get this output:
illegal operation signature: (eContainer())
and in level M2:
Unrecognized variable: (exportedEvents)
It's just not very comprehensible for me why I have to switch always.
> Unfortunately, this again requires that either you explicitly extend
> EObject in your model or you use the implicit root class option, in
> order to access the eContainer()) operation.
Thought that when I create a new ecore meta model all the elements
inherit from EObject. At least the generated classes extend EObject. But
one does not have to generate classes at all. Isn't it possible at all
to use the OCL console in this case because no classes are generated?
Can't imagine.
> Alternatively, perhaps
> your model already has some feature that generically returns the
> containing element?
Ok I can consider this. Until now I don't have any operations in my meta
model because I wanted to let it open if it will be used with Eclipse or
any other platform.
Thanks in advance Christian.
best regards,
Gilbert
[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786