Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Loading classes in Xbase-based DSL with interpreter(How to load classes from enclosing project)
Loading classes in Xbase-based DSL with interpreter [message #1802421] Fri, 08 February 2019 15:01 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 671
Registered: July 2009
Location: Trondheim, Norway
Senior Member
I've developed a DSL based on Xbase and have written a Java model inferrer that seems to correctly resolve classes that the enclosing project depends on. In particular, it finds classes and methods in a registered extension class.

I've also written an interpreter and an action to invoke it in the DSL editor. The interpreter, however, seems to use the classloader of the DSL UI project, so it differs from what the editor resolves. I know I can add the extension class (or the bundle it's in) to the UI project dependencies, but I also want it to pick up the classes in the enclosing project, i.e. the same as those seen by the editor. I notice the interpreter has a setClassLoader method, is there a pre-made classloader I can use to get the desired effect?

Regards,

Hallvard
Re: Loading classes in Xbase-based DSL with interpreter [message #1802422 is a reply to message #1802421] Fri, 08 February 2019 15:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13071
Registered: July 2009
Senior Member
i did some experiments with this years ago.
dont know if this still works
https://github.com/cdietrich/mql/blob/master/org.eclipse.xtext.mql.ui/src/org/eclipse/xtext/mqrepl/ui/handler/ModelQueryInterpreterHandler.java


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Loading classes in Xbase-based DSL with interpreter [message #1802425 is a reply to message #1802422] Fri, 08 February 2019 15:49 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 671
Registered: July 2009
Location: Trondheim, Norway
Senior Member
It's a good start, thanks! I was hoping Xtext/Xbase had something I could use, since it necessarily needs to keep track of the classpath when it populates the JvmType model.
Re: Loading classes in Xbase-based DSL with interpreter [message #1802510 is a reply to message #1802425] Mon, 11 February 2019 09:06 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1754
Registered: July 2009
Location: Firenze, Italy
Senior Member
I'm using the interpreter in one of my DSL.
I configure the class loader, inspired by one of the implementations of the seven languages in seven weeks.
This is the implementation: https://github.com/LorenzoBettini/edelta/blob/master/edelta.parent/edelta/src/edelta/interpreter/internal/EdeltaInterpreterConfigurator.java
Previous Topic:How to validate file names in generated file FileTemplateProvider
Next Topic:Action for a context menu on XtextEditor
Goto Forum:
  


Current Time: Fri Aug 23 15:34:06 GMT 2019

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

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

Back to the top