Lines 72-86
Link Here
|
72 |
* @return whether the resource should be included |
72 |
* @return whether the resource should be included |
73 |
* @throws InterruptedException if the user choose to cancel |
73 |
* @throws InterruptedException if the user choose to cancel |
74 |
*/ |
74 |
*/ |
75 |
public boolean shouldInclude(String message) throws InterruptedException { |
75 |
public boolean shouldInclude(final String message) throws InterruptedException { |
76 |
if (confirmation == YES_TO_ALL) { |
76 |
if (confirmation == YES_TO_ALL) { |
77 |
return true; |
77 |
return true; |
78 |
} else { |
78 |
} else { |
79 |
switch (confirmation) { |
79 |
switch (confirmation) { |
80 |
case ALWAYS_ASK: { |
80 |
case ALWAYS_ASK: { |
|
|
81 |
final boolean[] confirmOverwrite = new boolean[1]; |
81 |
// This call has the nasty side effect of changing the |
82 |
// This call has the nasty side effect of changing the |
82 |
// instance scoped "confirmation" |
83 |
// instance scoped "confirmation" |
83 |
if (confirmOverwrite(message)) { |
84 |
Shell shell = shellProvider.getShell(); |
|
|
85 |
if(shell == null){ |
86 |
return false; |
87 |
} |
88 |
shell.getDisplay().syncExec( |
89 |
new Runnable() { |
90 |
public void run() { |
91 |
try { |
92 |
confirmOverwrite[0] = confirmOverwrite(message); |
93 |
} catch (InterruptedException e) { |
94 |
confirmOverwrite[0] = false; |
95 |
} |
96 |
} |
97 |
}); |
98 |
if (confirmOverwrite[0]) { |
84 |
return true; |
99 |
return true; |
85 |
} |
100 |
} |
86 |
break; |
101 |
break; |
Lines 102-120
Link Here
|
102 |
* Opens the confirmation dialog based on the prompt condition settings. |
117 |
* Opens the confirmation dialog based on the prompt condition settings. |
103 |
*/ |
118 |
*/ |
104 |
private boolean confirmOverwrite(String msg) throws InterruptedException { |
119 |
private boolean confirmOverwrite(String msg) throws InterruptedException { |
|
|
120 |
|
105 |
Shell shell = shellProvider.getShell(); |
121 |
Shell shell = shellProvider.getShell(); |
106 |
if (shell == null) return false; |
122 |
if (shell == null) return false; |
107 |
final MessageDialog dialog = |
123 |
MessageDialog dialog = new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); |
108 |
new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); |
124 |
dialog.open(); |
109 |
|
|
|
110 |
// run in syncExec because callback is from an operation, |
111 |
// which is probably not running in the UI thread. |
112 |
shell.getDisplay().syncExec( |
113 |
new Runnable() { |
114 |
public void run() { |
115 |
dialog.open(); |
116 |
} |
117 |
}); |
118 |
if (hasMultiple) { |
125 |
if (hasMultiple) { |
119 |
switch (dialog.getReturnCode()) { |
126 |
switch (dialog.getReturnCode()) { |
120 |
case 0://Yes |
127 |
case 0://Yes |