Source:
<code>private void reload(final Repository repository) { if (form.isDisposed()) return; <START> if (repository == null) { <END> saveCommitMessageComponentState(); currentRepository = null; removeListeners(); StagingViewUpdate update = new StagingViewUpdate(null, null, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(false); updateSectionText(); form.setText(UIText.StagingView_NoSelectionTitle); return; } if (!isValidRepo(repository)) return; final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { if (!event.getResult().isOK()) return; asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }</code><technical_language>I reload callable thread. This achieved moving repository == null block asyncExec</technical_language>

Target:
private void reload(final Repository repository) { if (form.isDisposed()) return; if (repository == null) { asyncExec(new Runnable() { public void run() { clearRepository(); } }); return; } if (!isValidRepo(repository)) return; final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { if (!event.getResult().isOK()) return; asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }