am f8a2fbab: Merge change 9062 into donut
Merge commit 'f8a2fbab9094d5525179770e00042ac2f85be991' * commit 'f8a2fbab9094d5525179770e00042ac2f85be991': Adds call back to the SDK updater for SDK content notifications.
This commit is contained in:
committed by
Android Git Automerger
commit
9781a221e4
@@ -313,16 +313,7 @@ public class AdtPlugin extends AbstractUIPlugin {
|
|||||||
if (checkSdkLocationAndId()) {
|
if (checkSdkLocationAndId()) {
|
||||||
// if sdk if valid, reparse it
|
// if sdk if valid, reparse it
|
||||||
|
|
||||||
// add all the opened Android projects to the list of projects to be updated
|
reparseSdk();
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
} else if (PREFS_BUILD_VERBOSITY.equals(property)) {
|
} else if (PREFS_BUILD_VERBOSITY.equals(property)) {
|
||||||
mBuildVerbosity = BuildPreferencePage.getBuildLevel(
|
mBuildVerbosity = BuildPreferencePage.getBuildLevel(
|
||||||
@@ -1388,6 +1379,22 @@ public class AdtPlugin extends AbstractUIPlugin {
|
|||||||
SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$
|
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
|
* Prints messages, associated with a project to the specified stream
|
||||||
* @param stream The stream to write to
|
* @param stream The stream to write to
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public class AvdManagerAction implements IWorkbenchWindowActionDelegate, IObject
|
|||||||
null /*sdk log*/,
|
null /*sdk log*/,
|
||||||
sdk.getSdkLocation(),
|
sdk.getSdkLocation(),
|
||||||
false /*userCanChangeSdkRoot*/);
|
false /*userCanChangeSdkRoot*/);
|
||||||
|
window.addListeners(new UpdaterWindow.ISdkListener() {
|
||||||
|
public void onSdkChange() {
|
||||||
|
AdtPlugin.getDefault().reparseSdk();
|
||||||
|
}
|
||||||
|
});
|
||||||
window.open();
|
window.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package com.android.sdkuilib.internal.repository;
|
package com.android.sdkuilib.internal.repository;
|
||||||
|
|
||||||
import com.android.sdkuilib.internal.repository.UpdaterData.ISdkListener;
|
|
||||||
import com.android.sdkuilib.internal.widgets.AvdSelector;
|
import com.android.sdkuilib.internal.widgets.AvdSelector;
|
||||||
import com.android.sdkuilib.internal.widgets.AvdSelector.DisplayMode;
|
import com.android.sdkuilib.internal.widgets.AvdSelector.DisplayMode;
|
||||||
|
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package com.android.sdkuilib.internal.repository;
|
|||||||
import com.android.sdklib.internal.repository.Archive;
|
import com.android.sdklib.internal.repository.Archive;
|
||||||
import com.android.sdklib.internal.repository.IDescription;
|
import com.android.sdklib.internal.repository.IDescription;
|
||||||
import com.android.sdklib.internal.repository.Package;
|
import com.android.sdklib.internal.repository.Package;
|
||||||
import com.android.sdkuilib.internal.repository.UpdaterData.ISdkListener;
|
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import com.android.sdklib.internal.repository.Archive;
|
|||||||
import com.android.sdklib.internal.repository.IDescription;
|
import com.android.sdklib.internal.repository.IDescription;
|
||||||
import com.android.sdklib.internal.repository.Package;
|
import com.android.sdklib.internal.repository.Package;
|
||||||
import com.android.sdklib.internal.repository.RepoSource;
|
import com.android.sdklib.internal.repository.RepoSource;
|
||||||
import com.android.sdkuilib.internal.repository.UpdaterData.ISdkListener;
|
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.IInputValidator;
|
import org.eclipse.jface.dialogs.IInputValidator;
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.android.sdklib.internal.repository.RepoSources;
|
|||||||
import com.android.sdklib.internal.repository.ToolPackage;
|
import com.android.sdklib.internal.repository.ToolPackage;
|
||||||
import com.android.sdklib.internal.repository.Package.UpdateInfo;
|
import com.android.sdklib.internal.repository.Package.UpdateInfo;
|
||||||
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
||||||
|
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
@@ -67,10 +68,6 @@ class UpdaterData {
|
|||||||
|
|
||||||
private Shell mWindowShell;
|
private Shell mWindowShell;
|
||||||
|
|
||||||
public interface ISdkListener {
|
|
||||||
void onSdkChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UpdaterData(String osSdkRoot, ISdkLog sdkLog) {
|
public UpdaterData(String osSdkRoot, ISdkLog sdkLog) {
|
||||||
mOsSdkRoot = osSdkRoot;
|
mOsSdkRoot = osSdkRoot;
|
||||||
mSdkLog = sdkLog;
|
mSdkLog = sdkLog;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.android.sdklib.internal.repository.RepoSources;
|
|||||||
import com.android.sdklib.repository.SdkRepository;
|
import com.android.sdklib.repository.SdkRepository;
|
||||||
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
||||||
import com.android.sdkuilib.internal.tasks.ProgressTaskFactory;
|
import com.android.sdkuilib.internal.tasks.ProgressTaskFactory;
|
||||||
|
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
@@ -168,6 +169,14 @@ public class UpdaterWindowImpl {
|
|||||||
mExtraPages.add(new Object[]{ title, pageClass });
|
mExtraPages.add(new Object[]{ title, pageClass });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addListeners(ISdkListener listener) {
|
||||||
|
mUpdaterData.addListeners(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(ISdkListener listener) {
|
||||||
|
mUpdaterData.removeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to return the SWT shell.
|
* Helper to return the SWT shell.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,17 @@ public class UpdaterWindow {
|
|||||||
|
|
||||||
private UpdaterWindowImpl mWindow;
|
private UpdaterWindowImpl mWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for listeners on SDK modifications (ie new installed compoments, or deleted
|
||||||
|
* components)
|
||||||
|
*/
|
||||||
|
public interface ISdkListener {
|
||||||
|
/**
|
||||||
|
* Sent when the content of the SDK changed
|
||||||
|
*/
|
||||||
|
void onSdkChange();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new window. Caller must call open(), which will block.
|
* Creates a new window. Caller must call open(), which will block.
|
||||||
* @param sdkLog
|
* @param sdkLog
|
||||||
@@ -58,6 +69,21 @@ public class UpdaterWindow {
|
|||||||
mWindow.registerExtraPage(title, pageClass);
|
mWindow.registerExtraPage(title, pageClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new listener to be notified when a change is made to the content of the SDK.
|
||||||
|
*/
|
||||||
|
public void addListeners(ISdkListener listener) {
|
||||||
|
mWindow.addListeners(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a new listener to be notified anymore when a change is made to the content of
|
||||||
|
* the SDK.
|
||||||
|
*/
|
||||||
|
public void removeListener(ISdkListener listener) {
|
||||||
|
mWindow.removeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the window.
|
* Opens the window.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user