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:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user