Moose icon indicating copy to clipboard operation
Moose copied to clipboard

FamixNG support for mooseIcon methods

Open fuhrmanator opened this issue 2 years ago • 1 comments

When using Moose on our TypeScript models, we notice we don't get the cool icons for Method, Class, Interface, Attribute like in the FAMIX compatibility entities. Diving deeper, I see that the mooseIcon methods appear to have been added manually to those respective FAMIX compatibility entities.

I'm now wondering if it's possible to get the support for the mooseIcon methods via FamixNG (trying to minimize the manual intervention in the generated classes). For example, mooseIcon in FAMIXClass looks like:

mooseIcon
	^ self isInterface 
		ifTrue: [ MooseIcons famixInterface ]
		ifFalse: [ MooseIcons famixClass ]

Is there a way/example of how to generate this via the DSL?

fuhrmanator avatar Oct 28 '21 13:10 fuhrmanator

So, I spent some time using the Models browser (Moose-IDE) looks great by the way. I can see the icons are more or less working without the mooseIcon method into the entities, so maybe you can close this?

Still, it would be nice to know how to specify custom methods in the MM from the DSL, again to avoid the problem of manually-added things to a metamodel which requires some documenting if you want to reproduce them.

A quick internet search got me to ClassDescription>>#compileSilently: which is an extension used by Fuel, etc. to programmatically add a method to a class. I guess one could add methods this way after the metamodel is generated. I couldn't find a hook in the FamixMetamodelGenerator where to put such code (after entities are generated, something like #postLoadDoIt in Baselines?). Maybe this could be a blog topic?

fuhrmanator avatar Oct 28 '21 14:10 fuhrmanator

Great idea to enable the addition of methods in the generator! and to write a blog post on it. I close this issue, since it is no more relevant.

anneetien avatar Aug 25 '22 10:08 anneetien