How to add Xtext DSL editor in Multi-Page Editor

To add your Xtext Dsl Editor to Multi-Page Editor

Getting the instance of XText editor

 MyDslActivator activator = MyDslActivator.getInstance();  
 final Injector injector = activator.getInjector("org.shashwat.xtext.mydsl.MyDsl");  
 XtextEditor xtextEditor = injector.getInstance(XtextEditor.class);  

Remember to have editor input instance of IFileEditorInput. XtextEditor uses XtextDocumentProvider which extends FileDocumentProvider

 FileEditorInput fileEditorInput = new FileEditorInput(file); // Here file is instance of IFile  
 int index = addPage(xtextEditor, fileEditorInput);  

Comments

Popular posts from this blog

Comparison of Cloud Services

When to use Import-Package and Require-Bundle in Eclipse Plugin?