How to get Inheritance from java-stubs?
Hi,
I use some java classes that are imported by java-stubs. Is there a way in MPS to generate a list<string> of the classes that inherit from a concrete abstract class that is defined in these java-stubs? This list could be very useful for a custom completion menu in my editor.
For concepts in MPS this would be quite easy but can you do the same for classes in java stubs? (I do not want to transfer the whole Java code to MPS.)
Thanks,
Harry
Please sign in to leave a comment.
Harry,
Classes from stub models are actually nodes<ClassConcept>. So, you can operate with them like if they were MPS classes.
Btw, you can experience some performance problems because of the number of classes. You can look at ShowClassInHierarchy to view what we have done to implement a very same functionality. Maybe you'll be able to use some of our code. Using finders will also perform quite quick in this case (ClassAncestors finder), but there is no DSL construct to execute them in 1.1. You can look at GoToOverridingMethod action to view how to execute a finder (we'll add DSL expression for this functionality in the nearest releases).
Regards,
Mihail
Thank you, Mihail,
I will take a look at it.
Btw it would be very useful if MPS team could add some more info to the Smodel language section in your docs.
Especially, some demos (comparable to 'Generator demos' section in your docs) that show how to do tackle usual node
manipulation / editing / creation problems in MPS.
Best regards,
Harry