Project: JDT
Bug 66548 UIPerformChangeOperation doesn't completely guard UI access
Reported: 2004-06-10 12:46:40 | Status: verified fixed

In UIPerformChangeOperation::executeChange care is taken to execute the change on the UI thread, but "beginCompoundChange" and "endCompundChange" are not called on UI thread. I don't know if this is ever a problem in base Eclipse code, but our particular undoManager access a 'widget' and thus causes SWT thread access error, when the refactoring framework calls UIPerformChangeOperation::executeChange on our behalf. If it is the case that there is a contract is that "beginCompoundChange" and "endCompoundChange" are not supposed to to access UI thread, then I guess this would not be a bug in UIPerformChangeOperation, but I'd be surprised if this was part of "contract", since other methods in IRewriteTarget (e.g. redraw) would seem to need to access UI at some point (and doesn't seem to be specifically prohibited in JavaDoc of IRewriteTarget). My suggesttion is to move beginCompoundChange and endCompundChange to be inside the Runable that's created in executeChange (but haven't tried it yet).

Files changed in fix:
org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/UIPerformChangeOperation.java