use of net.sf.sdedit.error.DiagramError in project abstools by abstools.
the class Engine method _render.
private synchronized void _render(final boolean syntaxCheckOnly) {
editor.getUI().leaveFilterMode();
Diagram diagram = editor.getUI().renderDiagram();
// method is not synchronized. Why?
if (diagram == null) {
return;
}
DiagramError error = editor.getUI().getDiagramError();
if (error == null) {
editor.getUI().setErrorStatus(false, "", -1, -1);
if (diagram.getFragmentManager().openFragmentsExist()) {
editor.getUI().setErrorStatus(true, "Warning: There are open comments. Use [c:<type> <text>]...[/c]", -1, -1);
}
int noteNumber = diagram.getNextFreeNoteNumber();
if (noteNumber == 0) {
editor.getUI().setStatus("");
} else {
editor.getUI().setStatus("Next note number: " + diagram.getNextFreeNoteNumber());
}
} else {
editor.getUI().setStatus("");
if (error instanceof FatalError) {
FatalError fatal = (FatalError) error;
System.err.println("********************************************************");
System.err.println("* *");
System.err.println("* A FATAL ERROR HAS OCCURED. *");
System.err.println("* *");
System.err.println("********************************************************");
error.getCause().printStackTrace();
// cautiously embedding this call into a try/catch-block
try {
handle(diagram, fatal.getCause());
} catch (Throwable t) {
t.printStackTrace();
}
} else {
TextHandler handler = (TextHandler) error.getProvider();
String prefix = "";
if (error instanceof SemanticError) {
prefix = diagram.isThreaded() && diagram.getCallerThread() != -1 ? "Thread " + diagram.getCallerThread() + ": " : "";
}
editor.getUI().setErrorStatus(false, prefix + error.getMessage(), handler.getLineBegin() - 1, handler.getLineEnd());
}
}
if (!syntaxCheckOnly) {
editor.getUI().redraw();
}
}
use of net.sf.sdedit.error.DiagramError in project abstools by abstools.
the class Tab method renderDiagram.
void renderDiagram() {
PanelPaintDevice paintDevice = new PanelPaintDevice(true);
for (PanelPaintDeviceListener listener : ppdListeners) {
paintDevice.addListener(listener);
}
TextHandler textHandler = new TextHandler(getCode());
Diagram diagram = new Diagram(configuration.getDataObject(), textHandler, paintDevice);
DiagramError newError = null;
try {
diagram.generate();
} catch (RuntimeException e) {
newError = new FatalError(textHandler, e);
} catch (DiagramError e) {
newError = e;
}
synchronized (diagramStack) {
diagramStack.addLast(diagram);
synchronized (this) {
error = newError;
}
}
}
Aggregations