@Override
protected IFigure createFigure() {
// The figure associated with this graph edit part is only a
// free form layer
Figure root = new FreeformLayer();
root.setLayoutManager(new FreeformLayout());
IStatus status = (IStatus) getModel();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Throwable exc = status.getException();
Throwable cause = exc.getCause();
if (cause == null) {
exc.printStackTrace(new PrintStream(bos));
} else {
cause.printStackTrace(new PrintStream(bos));
}
Display d = Display.getCurrent();
Image image = d.getSystemImage(SWT.ICON_ERROR);
Label labelImage = new Label(image);
root.add(labelImage, new Rectangle(5, 5, -1, -1));
Label label = new Label(status.getMessage() + ": " + exc.getMessage()
+ "\n" + bos.toString());
root.add(label, new Rectangle(10 + image.getBounds().width, 5, -1, -1));
return root;
}