0
運行插件,我有一個DSL myDsl
我用這個代碼運行 它在Xtend
的Xtext,從選擇
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)
}
}
我想從方法launch(ISelection selection, String mode)
我到ressources和呼叫啓動執行myDslInterpreter類。我該怎麼做?
你看看https://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-上下文菜單/? –
不,我想看看我是否可以在我的情況下使用它 –
@ChristianDietrich完成,它的工作 –