AI 146600: am: CL 146597 am: CL 146595 ADT #1794560: prevent from loading more than one SDK at once.

Original author: raphael
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 146600
This commit is contained in:
Raphael Moll
2009-04-18 21:55:54 -07:00
committed by The Android Open Source Project
parent 9a77fe7c1b
commit 7ceec5e103

View File

@@ -177,6 +177,8 @@ public class AdtPlugin extends AbstractUIPlugin {
private ArrayList<ITargetChangeListener> mTargetChangeListeners = private ArrayList<ITargetChangeListener> mTargetChangeListeners =
new ArrayList<ITargetChangeListener>(); new ArrayList<ITargetChangeListener>();
protected boolean mSdkIsLoading;
/** /**
* Custom PrintStream for Dx output. This class overrides the method * Custom PrintStream for Dx output. This class overrides the method
* <code>println()</code> and adds the standard output tag with the * <code>println()</code> and adds the standard output tag with the
@@ -1011,6 +1013,14 @@ public class AdtPlugin extends AbstractUIPlugin {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
try { try {
if (mSdkIsLoading) {
return new Status(IStatus.WARNING, PLUGIN_ID,
"An Android SDK is already being loaded. Please try again later.");
}
mSdkIsLoading = true;
SubMonitor progress = SubMonitor.convert(monitor, SubMonitor progress = SubMonitor.convert(monitor,
"Initialize SDK Manager", 100); "Initialize SDK Manager", 100);
@@ -1093,6 +1103,7 @@ public class AdtPlugin extends AbstractUIPlugin {
} }
}); });
} finally { } finally {
mSdkIsLoading = false;
if (monitor != null) { if (monitor != null) {
monitor.done(); monitor.done();
} }