Skip to main content



      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 10:01 Go to next message
Eclipse UserFriend
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 10:14 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Loading classes in Xbase-based DSL with interpreter [message #1802425 is a reply to message #1802422] Fri, 08 February 2019 10:49 Go to previous messageGo to next message
Eclipse UserFriend
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 04:06 Go to previous message
Eclipse UserFriend
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: Thu Jun 12 21:59:59 EDT 2025

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

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

Back to the top