Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Goran Music is currently offline Goran MusicFriend
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 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 182
Registered: October 2014
Senior Member
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 #1838413 is a reply to message #1838404] Wed, 24 February 2021 14:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Extending rather than using Ecore classes is very strongly discouraged. UML2 and Classic OCL do so and are not the better for it.

Extending EAttribute/EReference is particularly unwise since they have built-in semantic assumptions and ownerships that your derivation may not satisfy.

Bottom line. Even if you magically get it working today, expect it to break tomorrow.

Regards

Ed Willink
Re: Handling instances of extended classes during runtime [message #1838416 is a reply to message #1838413] Wed, 24 February 2021 14:48 Go to previous messageGo to next message
Goran Music is currently offline Goran MusicFriend
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

Re: Handling instances of extended classes during runtime [message #1838419 is a reply to message #1838404] Wed, 24 February 2021 15:08 Go to previous messageGo to next message
Goran Music is currently offline Goran MusicFriend
Messages: 3
Registered: February 2021
Junior Member
Hi,
isn't E1 in this case exactly like Var then?
Cheers
Goran
Re: Handling instances of extended classes during runtime [message #1838426 is a reply to message #1838419] Wed, 24 February 2021 17:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

EMF does not go out of its way to prevent you being possibly stupid since what you are doing might be innovative, but if you do questionable things expect trouble, so somethings may fail and confusingly others may not. Reflectively you do not need to satisfy the stronger disciplines of Java generation so you may get away with more.

If you want your own metametamodel then design it/clone it, don't try to morph Ecore.

Regards

Ed Willink
Previous Topic:Unable to build Sirius Desktop
Next Topic:Delete edge mapping from .odesign
Goto Forum:
  


Current Time: Tue Apr 23 06:11:19 GMT 2024

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

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

Back to the top