Commit e121f403 authored by Johannes Roith's avatar Johannes Roith

Bugfix.

parent c9770793
......@@ -2,10 +2,15 @@ package de.tum.in.www2.cupplugin.debug;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.widgets.Display;
import de.tum.in.www2.cupplugin.editors.CupTextEditor;
import de.tum.in.www2.cupplugin.editors.RevisionManager;
import de.tum.in.www2.cupplugin.model.Model;
......@@ -166,8 +171,18 @@ public class Debugger {
return selfBuiltAstCache;
} else {
Model m = Model.getInstanceForDocument(document);
ParserResult astModel = m.getAstModel();
return astModel;
// hack.
List<ParserResult> lst = new ArrayList<ParserResult>();
Display.getDefault().syncExec(new Runnable() {
public void run() {
lst.add(m.getAstModel());
}
});
if (lst.size() == 1)
return lst.get(0);
return null;
}
}
}
\ No newline at end of file
......@@ -97,7 +97,7 @@ public class Model {
}
private void ensureUIThread() {
if (Thread.currentThread() != Display.getCurrent().getThread())
if (Display.getCurrent() == null || Thread.currentThread() != Display.getCurrent().getThread())
throw new RuntimeException("The model can only be modified or read from the UI thread.");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment