try {
workbench.getProgressService().run(true, true, new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
XtextDocument doc = ((ModelQueryLanguageView) view).getEmbeddedEditor().getDocument();
String result = doc.readOnly(new IUnitOfWork<String, XtextResource>() {
@Override
public String exec(XtextResource r) throws Exception {
Model m = (Model) r.getContents().get(0);
return interpret(m, monitor);
}
});
ref.set(result);
}
});
mqlv.getEmbeddedEditorResult().getDocument().set(ref.get());
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
} else if (activeEditor != null && activeEditor instanceof XtextEditor) {
final XtextEditor editor = (XtextEditor) activeEditor;
final Holder<String> ref = new Holder<String>();
try {
workbench.getProgressService().run(true, true, new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
XtextDocument doc = (XtextDocument) editor.getDocument();
String result = doc.readOnly(new IUnitOfWork<String, XtextResource>() {
@Override
public String exec(XtextResource r) throws Exception {
Model m = (Model) r.getContents().get(0);
return interpret(m, monitor);
}