public Object execute(ExecutionEvent event) {
final IWorkbenchPart view = HandlerUtil.getActivePart(event);
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (view instanceof ModelQueryLanguageView) {
final ModelQueryLanguageView mqlv = (ModelQueryLanguageView) view;
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 = ((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();
}