am 8ccddf4c: Merge change Id49751eb into eclair-sdk
Merge commit '8ccddf4c00464c6fee998d56da1f08b4662abf62' into eclair * commit '8ccddf4c00464c6fee998d56da1f08b4662abf62': SDK Manager: reuse complete downloads, retry Windows locks.
This commit is contained in:
@@ -19,6 +19,8 @@ package com.android.sdkuilib.internal.tasks;
|
||||
import com.android.sdklib.internal.repository.ITask;
|
||||
import com.android.sdklib.internal.repository.ITaskMonitor;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
@@ -142,6 +144,30 @@ public final class ProgressTask implements ITaskMonitor {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a yes/no question dialog box.
|
||||
*
|
||||
* This implementation allow this to be called from any thread, it
|
||||
* makes sure the dialog is opened synchronously in the ui thread.
|
||||
*
|
||||
* @param title The title of the dialog box
|
||||
* @param message The error message
|
||||
* @return true if YES was clicked.
|
||||
*/
|
||||
public boolean displayPrompt(final String title, final String message) {
|
||||
final Shell shell = mDialog.getParent();
|
||||
Display display = shell.getDisplay();
|
||||
|
||||
// we need to ask the user what he wants to do.
|
||||
final boolean[] result = new boolean[] { false };
|
||||
display.syncExec(new Runnable() {
|
||||
public void run() {
|
||||
result[0] = MessageDialog.openQuestion(shell, title, message);
|
||||
}
|
||||
});
|
||||
return result[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a sub-monitor that will use up to tickCount on the progress bar.
|
||||
* tickCount must be 1 or more.
|
||||
@@ -222,6 +248,10 @@ public final class ProgressTask implements ITaskMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean displayPrompt(String title, String message) {
|
||||
return mRoot.displayPrompt(title, message);
|
||||
}
|
||||
|
||||
public ITaskMonitor createSubMonitor(int tickCount) {
|
||||
assert mSubCoef > 0;
|
||||
assert tickCount > 0;
|
||||
|
||||
Reference in New Issue
Block a user