Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] viewer.getControl().setRedraw(false);

This is a design question concerning where to put setRedraw() calls in the Platform.

Background: In the CVS Repository view, RemoteViewPart.refreshViewer() calls TreeViewer.refresh(). If you have a couple thousand items in the tree and you're running on Windows this takes a few seconds. First you see the scroll bar thumb get bigger and bigger as items are sucked out of the tree, then there's a flash, then items start populating back in and the scroll bar gets smaller and smaller. The Eclipse UI is unresponsive during this period. If you plug the speakers in you'll hear a "woooOP! Whoooo" sound as this happens (j/k). https://bugs.eclipse.org/bugs/show_bug.cgi?id=91558 has been filed to track this particular problem.

A setRedraw() call at the right place can fix this, though it makes it much less interesting to watch. I'm not sure the best place to put it though.

Fix 1: in RemoteViewPart.refreshViewer(), surround the refresh call with setRedraw(false) and setRedraw(true) calls, like this:

		viewer.getControl().setRedraw(false);
		viewer.refresh();
		viewer.getControl().setRedraw(true);

This would affect only this one spot in the CVS view.

Fix 2: Put the calls inside TreeViewer.refresh() (Actually StructuredViewer.refresh(Object)). This would affect all structured viewers.

Fix 3: Put the calls inside AbstractTreeViewer.internalRefresh(Object).
Fix 4: Put the calls inside AbstractTreeViewer.internalRefresh(Widget, Object, boolean, boolean) (called from the routine in Fix 3).
Fix 5. Put the calls inside AbstractTreeViewer.internalRefreshStruct(Widget, Object, boolean) (called from the routine in Fix 4).
etc... all the way down to SWT. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=91558 for the full tracebacks.

So basically the question is should setRedraw() calls be done at as high a level as possible, as low as possible, or somewhere in between? Should it be done in one place that affects everybody or in lots of places as cases are found (CVS Repository, Package viewer, Outline view, etc.)? And should it be conditional on the size of the operation, if that can be quickly determined?




Back to the top