Bug 95658 [Workbench] Events are being dispatched and async/syncExecs are run before the Workbench is in a good state
As part of plug-in startup and activation, anyone can call Display.readAndDispatch() to process UI events. This will also run any outstanding asyncExecs and syncExecs. For example, ModalContext.ModalContextThread#block calls readAndDispatch. This in turn is indirectly called by ProgressManager#run, which is called by CVS's AllRootsElement when the repositories view is created. The code that restores the Workbench is written in a way that it assumes no events are dispatched and no async/syncExecs are run before the 'real' UI event loop runs. This is a false assumption. I am attaching source for a modified UISynchronizer that delays at least the async/syncExecs until it is safe to run them. However, this creates a new problem in that ModalContext.ModalContextThread#block actually blocks forever because the syncExec in ModalContext.ModalContextThread#run is not being executed. We should either be prepared for anyone to call into Workbench methods even before we run the event loop, or use something along the lines of the attached UISycnhronizer to prevent this from happening.
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java
System.err.println("Called from:"); 
                            
                            
                            new InvocationTargetException(null)
                                    .printStackTrace();
                        }
                        if (throwable instanceof InvocationTargetException) {
                            throw (InvocationTargetException) throwable;
                        } else if (throwable instanceof InterruptedException) {
                            throw (InterruptedException) throwable;
                        } else if (throwable instanceof OperationCanceledException) {
                            
                            throw new InterruptedException(throwable
                                    .getMessage());
                        } else {
                            throw new InvocationTargetException(throwable);
                        }
                    }
                }
            }
        } finally {
            modalLevel--;
        }
    }
    /**
     * Run a runnable.  Convert all thrown exceptions to 
     * either InterruptedException or InvocationTargetException
     */
    private static void runInCurrentThread(IRunnableWithProgress runnable,
            IProgressMonitor progressMonitor) throws InterruptedException,