### Eclipse Workspace Patch 1.0 #P org.eclipse.draw2d Index: src/org/eclipse/draw2d/DeferredUpdateManager.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/DeferredUpdateManager.java,v retrieving revision 1.22 diff -u -r1.22 DeferredUpdateManager.java --- src/org/eclipse/draw2d/DeferredUpdateManager.java 5 Apr 2006 14:21:13 -0000 1.22 +++ src/org/eclipse/draw2d/DeferredUpdateManager.java 12 Dec 2006 21:10:47 -0000 @@ -55,6 +55,7 @@ private boolean updateQueued = false; private boolean updating; +private boolean validating = false; private RunnableChain afterUpdate; private static class RunnableChain { @@ -137,18 +138,29 @@ void paint(GC gc) { SWTGraphics graphics = new SWTGraphics(gc); + Rectangle rect = graphics.getClip(new Rectangle()); if (!updating) { /** * If a paint occurs not as part of an update, we should notify that the region * is being painted. Otherwise, notification already occurs in repairDamage(). */ HashMap map = new HashMap(); - Rectangle rect = graphics.getClip(new Rectangle()); map.put(root, rect); firePainting(rect, map); } - root.paint(graphics); - graphics.dispose(); + if (!validating) { + performValidation(); + root.paint(graphics); + graphics.dispose(); + } else { + /* + * If figures are being validated then we can simply + * add a dirty region here and update will repaint this region with other + * dirty regions when it gets to painting. We can't paint if we're not sure + * that all figures are valid. + */ + addDirtyRegion(root, rect); + } } /** @@ -185,14 +197,17 @@ return; try { IFigure fig; + validating = true; fireValidating(); for (int i = 0; i < invalidFigures.size(); i++) { + System.out.println("FOR: " + i + " out of " + invalidFigures.size()); fig = (IFigure) invalidFigures.get(i); invalidFigures.set(i, null); fig.validate(); } } finally { invalidFigures.clear(); + validating = false; } }