I have a DSL myDsl
that i run with this code
It's in Xtend
class LaunchMydslShortcut implements ILaunchShortcut {
@Inject
private IResourceForEditorInputFactory resourceFactory;
override launch(ISelection selection, String mode) {
println("launch from selection")
}
override launch(IEditorPart editor, String mode) {
val input = editor.editorInput
if (editor instanceof XtextEditor && input instanceof FileEditorInput) {
val resource = resourceFactory.createResource(input)
resource.load(newHashMap())
val program = resource.contents.head as Script
new MyDslInterpreter().exec(program)
}
}
I want to launch the the execution from the method launch(ISelection selection, String mode)
I have to the ressources and call the myDslInterpreter clas. how can I do it?
Here is the code from a Handler calling a Xtext IGenerator on a File. You should be able to adapt it for your case