### Eclipse Workspace Patch 1.0 #P org.eclipse.team.ui Index: src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java,v retrieving revision 1.5 diff -u -r1.5 MultipleYesNoPrompter.java --- src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java 16 Mar 2007 21:03:35 -0000 1.5 +++ src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java 6 Aug 2009 10:08:14 -0000 @@ -72,15 +72,30 @@ * @return whether the resource should be included * @throws InterruptedException if the user choose to cancel */ - public boolean shouldInclude(String message) throws InterruptedException { + public boolean shouldInclude(final String message) throws InterruptedException { if (confirmation == YES_TO_ALL) { return true; } else { switch (confirmation) { case ALWAYS_ASK: { + final boolean[] confirmOverwrite = new boolean[1]; // This call has the nasty side effect of changing the // instance scoped "confirmation" - if (confirmOverwrite(message)) { + Shell shell = shellProvider.getShell(); + if(shell == null){ + return false; + } + shell.getDisplay().syncExec( + new Runnable() { + public void run() { + try { + confirmOverwrite[0] = confirmOverwrite(message); + } catch (InterruptedException e) { + confirmOverwrite[0] = false; + } + } + }); + if (confirmOverwrite[0]) { return true; } break; @@ -102,19 +117,11 @@ * Opens the confirmation dialog based on the prompt condition settings. */ private boolean confirmOverwrite(String msg) throws InterruptedException { + Shell shell = shellProvider.getShell(); if (shell == null) return false; - final MessageDialog dialog = - new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); - - // run in syncExec because callback is from an operation, - // which is probably not running in the UI thread. - shell.getDisplay().syncExec( - new Runnable() { - public void run() { - dialog.open(); - } - }); + MessageDialog dialog = new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); + dialog.open(); if (hasMultiple) { switch (dialog.getReturnCode()) { case 0://Yes