// We need to modify the viewport layout so that it adjusts the
// size of the viewport contents according to the viewport size.
// The contents cannot be bigger than the viewport otherwise it
// will break the tray scrolling.
canvas.getViewport().setLayoutManager(new ViewportLayout() {
@Override
public void layout(IFigure figure) {
Viewport viewport = (Viewport)figure;
IFigure contents = viewport.getContents();