Home » Eclipse Projects » Sirius » Handling instances of extended classes during runtime(Extended classes are not rendered properly during runtime)
Handling instances of extended classes during runtime [message #1838296] |
Sat, 20 February 2021 21:28 |
Goran Music Messages: 3 Registered: February 2021 |
Junior Member |
|
|
Hello everyone!
Since this is my first post here, a little bit about my background beforehand - I'm an industrial automation engineer dabbling in DSL engineering with EMF/Sirius since 2016 (I'm in love with it, pure genius, a big thanks to all creators and contributors). My level of expertise is therefore predominantly low-level programming similar to embedded systems development. When it comes to DSL engineering and Sirius, I would consider myself an aspiring intermediate, however still on the beginner level. Until now I've went through all what I could find online and managed to create a couple of simple but useful DSLs. For the past 6 months I've been creating a more comprehensive modeling tool. Some time ago I hit a wall, and after several weeks of trying anything and everything, I think I'm losing my mind, if there is something still left there. Help!;)
The problem is complex (at least for me), I'll do my best to represent it as simple as possible:
What I want to do:
Theoretically, I would like to implement the pattern called "dynamic features". Practically, I would like to extend (reuse some properties of) the EAttribute structural feature in my metamodel (EClass Var with SuperType EAttribute). The goal is to, if another class from the metamodel (VarContainer) containing 0..* Vars is instantiated during runtime, i can add its children (Var instances) and determine their types dynamically. This functions perfectly when creating dynamic model instances directly from the metamodel ("offline").
The problem:
During runtime, instances of the VarContainer report the error
Cannot invoke
"org.eclipse.emf.edit.provider.IItemLabelProvider.getImage(Object)" because "itemLabelProvider" is null .
No children (Vars) can therefore be added during runtime. Furthermore, the existing VarContainer children are not rendered/parsed properly in the ModelExplorer, only textual representation is shown:
org.eclipse.emf.ecore.impl.EAttributeImpl@6f48bbde(eClass: org.eclipse.emf.ecore.impl.EclassImpl@122707013b (name:VAR) (instanceClassName: VarInstance)(abstract:false, interace:false))(name: ID)(ordered:true, unique:true, lowerBound:0, upperBound:1)
nor can they be accessed through custom diagrams, even though the Eclass Information shows the proper Ecore structure with all EAttribute properties. No Eclass Information is shown for the VarContainer instances.
What I've tried so far:
-Every variant of "electrical engineers first remedy" - turn off and on, uninstall, reinstall, different versions, variants, even computers :) - to no avail
-adapting Java versions and different path configurations
-all thinkable plugin combinations (I always come back to these though, there seems to be something rotten there)
-all thinkable combinations of Label Provider Generator configurations
-searching every nook and cranny on the community forums (here and EMF / Eclipse / Java in general).
-...
A weird coincidence that somehow seems to have something to do with this:
- In the offline Ecore metamodel, no properties are shown for attributes of any class (the Ecore Page in the properties view is completely empty). In the Table view they can be accessed and changed without problems.
I'd be very grateful for any kind of assistance or a clue. I'm aware that the question is chaotic to say the least, I'll be glad to provide any further needed information or explanations.
Thanks a bunch !
PS I'm using the LSV Eclipse & Sirius, but have also tried older versions
[Updated on: Mon, 22 February 2021 22:51] Report message to a moderator
|
|
|
Re: Handling instances of extended classes during runtime [message #1838404 is a reply to message #1838296] |
Wed, 24 February 2021 11:20 |
|
Hello
About your metamodel definition, You said "EClass Var with SuperType EAttribute"
I would rather have expected to have a EClass E1 of Type EAttribute and another EClass Var which super type is E1
I do not see why you could not have EAttribute as a super type of your class even if it is not common to see this case. :)
Anyway, I am not sure to be the right person to help you.
Your issue seems to be related to the pure EMF matter (not Sirius).
Try and ask your question on EMF forum.
Best regards
Laurent
Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: Handling instances of extended classes during runtime [message #1838416 is a reply to message #1838413] |
Wed, 24 February 2021 14:48 |
Goran Music Messages: 3 Registered: February 2021 |
Junior Member |
|
|
Hi Laurent and Ed,
thank you very much for your replies!
@ Laurent
I think I will try to post to the general EMF Forum as well, however my initial thoughts were to ask here because the "error" happens during model rendering, quasi closer to the Sirius dominion (and also, Sirius is the new GMF, or am I understanding something wrong?:-)
@Ed
Yeah, I was thinking from your previous posts that you might say something like that. Now after some time of trying it, I think I also know why:D
But I still do not really understand it - why is it possible to define an EClass with an Ecore SuperType at all? And why does the reflective tree editor have no problem whatsoever with rendering them (with the full set of the SuperType properties) when creating dynamic model instances ("offline"), but this seems to not be possible (for me at least:) during runtime?
I know I'm on the fringe territory here, but is there any way to "trick" the runtime instances to be rendered in the same way the dynamic instances are offline?
Thanks again!
Cheers
Goran
PS I'm aware that what I'm actually trying to do here is cheat my way through "pushing" the class-object relationship a metalevel down, so that users can create type-classes (or in my case Attributes i.e. Vars), which can than be instantiated (by users). Seems to be so close yet so far:-)
[Updated on: Wed, 24 February 2021 14:59] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Wed Apr 24 23:59:29 GMT 2024
Powered by FUDForum. Page generated in 0.03930 seconds
|