Adds call back to the SDK updater for SDK content notifications.

Make ADT reload the SDK when a new package is installed/removed through the
SDK Updater.
This commit is contained in:
Xavier Ducrohet
2009-07-29 17:36:21 -07:00
parent eee1675aa4
commit 9057041cf8
8 changed files with 61 additions and 17 deletions

View File

@@ -313,16 +313,7 @@ public class AdtPlugin extends AbstractUIPlugin {
if (checkSdkLocationAndId()) {
// if sdk if valid, reparse it
// add all the opened Android projects to the list of projects to be updated
// after the SDK is reloaded
synchronized (getSdkLockObject()) {
// get the project to refresh.
IJavaProject[] androidProjects = BaseProjectHelper.getAndroidProjects();
mPostLoadProjectsToResolve.addAll(Arrays.asList(androidProjects));
}
// parse the SDK resources at the new location
parseSdkContent();
reparseSdk();
}
} else if (PREFS_BUILD_VERBOSITY.equals(property)) {
mBuildVerbosity = BuildPreferencePage.getBuildLevel(
@@ -1388,6 +1379,22 @@ public class AdtPlugin extends AbstractUIPlugin {
SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$
}
/**
* Reparses the content of the SDK and updates opened projects.
*/
public void reparseSdk() {
// add all the opened Android projects to the list of projects to be updated
// after the SDK is reloaded
synchronized (getSdkLockObject()) {
// get the project to refresh.
IJavaProject[] androidProjects = BaseProjectHelper.getAndroidProjects();
mPostLoadProjectsToResolve.addAll(Arrays.asList(androidProjects));
}
// parse the SDK resources at the new location
parseSdkContent();
}
/**
* Prints messages, associated with a project to the specified stream
* @param stream The stream to write to

View File

@@ -49,6 +49,11 @@ public class AvdManagerAction implements IWorkbenchWindowActionDelegate, IObject
null /*sdk log*/,
sdk.getSdkLocation(),
false /*userCanChangeSdkRoot*/);
window.addListeners(new UpdaterWindow.ISdkListener() {
public void onSdkChange() {
AdtPlugin.getDefault().reparseSdk();
}
});
window.open();
}
}