Skip to content

Instantly share code, notes, and snippets.

@serge1
Last active September 27, 2015 15:46
Show Gist options
  • Save serge1/02e9714f5a7654d54c5a to your computer and use it in GitHub Desktop.
Save serge1/02e9714f5a7654d54c5a to your computer and use it in GitHub Desktop.
Xtext Dsl Editor in Multi-Page Editor
To add you 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment