SuperClass gets displayed with SubClass [message #1810266] |
Tue, 06 August 2019 05:19  |
Eclipse User |
|
|
|
Hi,
I got a rather strange problem.
I created an ecore meta model with a class that is a supertype to another class. Lets say the superclass is called ClassA and the other class is SubClassA1.
When I create an instance of SubClassA1, the editor als creates a representation of ClassA. It is not possible to delete only the ClassA representation without deleting the SubClassA1 representation.
From my own research on the internet I found out, that I am supposed to use the "Semantic Candidates Expression" of the ClassA node to solve this problem. But for some reason, the expressions I found online do not work for me.
Example:
aql:self.yourContainmentReference.oclIsTypeOf(yourPackage::SuperTypeA)
Of course I switched out the nessessary parts. It looked kinda like this.
aql:self.classa.oclIsTypeOf(exampleProject::ClassA)
I hope someone here can help me.
Regards,
Florian
|
|
|
|
|
Re: SuperClass gets displayed with SubClass [message #1810280 is a reply to message #1810269] |
Tue, 06 August 2019 09:07   |
Eclipse User |
|
|
|
Hello,
Ok I think I have a better understanding with the screenshot. I hadn't noticed the first time, but with your expression you are trying to do two thing at once, identify candidates and filter by type so you should use oclAsType to cast, instead of oclIsTypeOf that returns a boolean.
If it is easier, you can do it in two steps. For your candidate expression, you can use only aql:self.classa, as it is the reference in your metamodel. Note that you can also use the expression "feature:classa" that is more performant. Then you want to filter by type, this can be done in the "Precondition Expression" field in the advance tab. Here the expression will be aql:self.oclIsTypeOf(exampleProject::ClassA) or SubClassA1 depending on the mapping.
Concerning the errors about the unaccessible types, can you check that in the Manifest.MF file of your project, you have a dependency to your metamodel? Also, in your .odesign, if you select your DiagramDescription "exampleDiagram", you can go to the metamodel tab and add your metamodel using the registry or the workspace. This should further check that you have access to your metamodel.
Regards,
Steve
|
|
|
|
|
Re: SuperClass gets displayed with SubClass [message #1810290 is a reply to message #1810285] |
Tue, 06 August 2019 10:57  |
Eclipse User |
|
|
|
Hi,
I created the project through New -> Ecore Modeling Project.
From there I created the meta model and then generated the model, edit and editor code. I made no further changes to the project (Name, Ns URI and NS Prefix are set from the beginning, so I didn't change anything there)
Regards,
Florian
|
|
|
Powered by
FUDForum. Page generated in 0.23613 seconds