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:
@@ -16,9 +16,9 @@
|
||||
|
||||
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.DisplayMode;
|
||||
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
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.IDescription;
|
||||
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.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.Package;
|
||||
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.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.Package.UpdateInfo;
|
||||
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
||||
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
@@ -67,10 +68,6 @@ class UpdaterData {
|
||||
|
||||
private Shell mWindowShell;
|
||||
|
||||
public interface ISdkListener {
|
||||
void onSdkChange();
|
||||
}
|
||||
|
||||
public UpdaterData(String osSdkRoot, ISdkLog sdkLog) {
|
||||
mOsSdkRoot = osSdkRoot;
|
||||
mSdkLog = sdkLog;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.android.sdklib.internal.repository.RepoSources;
|
||||
import com.android.sdklib.repository.SdkRepository;
|
||||
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
|
||||
import com.android.sdkuilib.internal.tasks.ProgressTaskFactory;
|
||||
import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
@@ -168,6 +169,14 @@ public class UpdaterWindowImpl {
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,17 @@ public class UpdaterWindow {
|
||||
|
||||
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.
|
||||
* @param sdkLog
|
||||
@@ -58,6 +69,21 @@ public class UpdaterWindow {
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user