public void run() { if (!isActive() || !isRunning()) return; int v = getCurrentVTile(); int sy1 = v * tileSize.height; int sy2 = Math.min((v + 1) * tileSize.height, getSourceRectangle().height); int h = getCurrentHTile(); int sx1 = h * tileSize.width; int sx2 = Math.min((h + 1) * tileSize.width, getSourceRectangle().width); org.eclipse.draw2d.geometry.Point p = getSourceRectangle().getLocation(); Rectangle rect = new Rectangle(sx1 + p.x, sy1 + p.y, sx2 - sx1, sy2 - sy1); thumbnailGraphics.pushState(); thumbnailGraphics.setClip(rect); thumbnailGraphics.fillRectangle(rect); sourceFigure.paint(thumbnailGraphics); thumbnailGraphics.popState(); if (getCurrentHTile() < (hTiles - 1)) setCurrentHTile(getCurrentHTile() + 1); else { setCurrentHTile(0); if (getCurrentVTile() < (vTiles - 1)) setCurrentVTile(getCurrentVTile() + 1); else setCurrentVTile(0); } if (getCurrentHTile() != 0 || getCurrentVTile() != 0) Display.getCurrent().asyncExec(this); else if (isDirty()) { setDirty(false); Display.getCurrent().asyncExec(this); repaint(); } else { stop(); repaint(); } }