SDK Updater: remove UpdaterData() constructor.
We don't really need for SWT Designer. Also fix the main window icon to show it again.
This commit is contained in:
@@ -44,13 +44,12 @@ public class AvdManagerPage extends Composite implements ISdkListener {
|
||||
/**
|
||||
* Create the composite.
|
||||
* @param parent The parent of the composite.
|
||||
* @param updaterData An instance of {@link UpdaterData}. If null, a local
|
||||
* one will be allocated just to help with the SWT Designer.
|
||||
* @param updaterData An instance of {@link UpdaterData}.
|
||||
*/
|
||||
public AvdManagerPage(Composite parent, UpdaterData updaterData) {
|
||||
super(parent, SWT.BORDER);
|
||||
|
||||
mUpdaterData = updaterData != null ? updaterData : new UpdaterData();
|
||||
mUpdaterData = updaterData;
|
||||
mUpdaterData.addListeners(this);
|
||||
|
||||
createContents(this);
|
||||
@@ -92,7 +91,7 @@ public class AvdManagerPage extends Composite implements ISdkListener {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
//onDelete();
|
||||
//TODO onDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,14 +75,12 @@ public class LocalPackagesPage extends Composite implements ISdkListener {
|
||||
/**
|
||||
* Create the composite.
|
||||
* @param parent The parent of the composite.
|
||||
* @param updaterData An instance of {@link UpdaterData}. If null, a local
|
||||
* one will be allocated just to help with the SWT Designer.
|
||||
* @param updaterData An instance of {@link UpdaterData}.
|
||||
*/
|
||||
public LocalPackagesPage(Composite parent,
|
||||
UpdaterData updaterData) {
|
||||
public LocalPackagesPage(Composite parent, UpdaterData updaterData) {
|
||||
super(parent, SWT.BORDER);
|
||||
|
||||
mUpdaterData = updaterData != null ? updaterData : new UpdaterData();
|
||||
mUpdaterData = updaterData;
|
||||
mUpdaterData.addListeners(this);
|
||||
|
||||
createContents(this);
|
||||
|
||||
@@ -80,14 +80,12 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
|
||||
/**
|
||||
* Create the composite.
|
||||
* @param parent The parent of the composite.
|
||||
* @param updaterData An instance of {@link UpdaterData}. If null, a local
|
||||
* one will be allocated just to help with the SWT Designer.
|
||||
* @param updaterData An instance of {@link UpdaterData}.
|
||||
*/
|
||||
RemotePackagesPage(Composite parent,
|
||||
UpdaterData updaterData) {
|
||||
RemotePackagesPage(Composite parent, UpdaterData updaterData) {
|
||||
super(parent, SWT.BORDER);
|
||||
|
||||
mUpdaterData = updaterData != null ? updaterData : new UpdaterData();
|
||||
mUpdaterData = updaterData;
|
||||
mUpdaterData.addListeners(this);
|
||||
|
||||
createContents(this);
|
||||
|
||||
@@ -68,14 +68,6 @@ class UpdaterData {
|
||||
initSdk();
|
||||
}
|
||||
|
||||
/**
|
||||
* default access constructor used by the pages when instantiated by the SWT designer.
|
||||
*/
|
||||
UpdaterData() {
|
||||
mOsSdkRoot = null;
|
||||
mSdkLog = null;
|
||||
}
|
||||
|
||||
public void setOsSdkRoot(String osSdkRoot) {
|
||||
if (mOsSdkRoot == null || mOsSdkRoot.equals(osSdkRoot) == false) {
|
||||
mOsSdkRoot = osSdkRoot;
|
||||
@@ -208,7 +200,9 @@ class UpdaterData {
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the list of given {@link Archive}s.
|
||||
* Install the list of given {@link Archive}s. This is invoked by the user selecting some
|
||||
* packages in the remote page and then clicking "install selected".
|
||||
*
|
||||
* @param archives The archives to install. Incompatible ones will be skipped.
|
||||
*/
|
||||
public void installArchives(final Collection<Archive> archives) {
|
||||
@@ -221,7 +215,6 @@ class UpdaterData {
|
||||
// or ask user to confirm downgrades. All this should be done in a separate class+window
|
||||
// which will then call this method with the final list.
|
||||
|
||||
// TODO move most parts to SdkLib, maybe as part of Archive, making archives self-installing.
|
||||
mTaskFactory.start("Installing Archives", new ITask() {
|
||||
public void run(ITaskMonitor monitor) {
|
||||
|
||||
@@ -266,10 +259,14 @@ class UpdaterData {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to update all the *existing* local packages.
|
||||
* This first refreshes all sources, then compares the available remote packages when
|
||||
* the current local ones and suggest updates to be done to the user. Finally all
|
||||
* selected updates are installed.
|
||||
*/
|
||||
public void updateAll() {
|
||||
if (mTaskFactory == null) {
|
||||
throw new IllegalArgumentException("Task Factory is null");
|
||||
}
|
||||
assert mTaskFactory != null;
|
||||
|
||||
mTaskFactory.start("Update Archives", new ITask() {
|
||||
public void run(ITaskMonitor monitor) {
|
||||
@@ -277,17 +274,25 @@ class UpdaterData {
|
||||
|
||||
monitor.setDescription("Refresh sources");
|
||||
refreshSources(true, monitor.createSubMonitor(1));
|
||||
|
||||
// TODO compare available vs local
|
||||
// TODO suggest update packages to user (also validate license click-through)
|
||||
// TODO install selected packages
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh sources
|
||||
* Refresh all sources. This is invoked either internally (reusing an existing monitor)
|
||||
* or as a UI callback on the remote page "Refresh" button (in which case the monitor is
|
||||
* null and a new task should be created.)
|
||||
*
|
||||
* @param forceFetching When true, load sources that haven't been loaded yet. When
|
||||
* false, only refresh sources that have been loaded yet.
|
||||
*/
|
||||
public void refreshSources(final boolean forceFetching, ITaskMonitor monitor) {
|
||||
assert mTaskFactory != null;
|
||||
|
||||
ITask task = new ITask() {
|
||||
public void run(ITaskMonitor monitor) {
|
||||
ArrayList<RepoSource> sources = mSources.getSources();
|
||||
|
||||
@@ -100,7 +100,6 @@ public class UpdaterWindowImpl {
|
||||
*/
|
||||
protected void createContents() {
|
||||
mAndroidSdkUpdater = new Shell();
|
||||
setWindowImage(mAndroidSdkUpdater);
|
||||
mAndroidSdkUpdater.addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
onAndroidSdkUpdaterDispose(); //$hide$ (hide from SWT designer)
|
||||
@@ -204,6 +203,8 @@ public class UpdaterWindowImpl {
|
||||
mUpdaterData.setTaskFactory(mTaskFactory);
|
||||
mUpdaterData.setImageFactory(new ImageFactory(getShell().getDisplay()));
|
||||
|
||||
setWindowImage(mAndroidSdkUpdater);
|
||||
|
||||
addPage(mAvdManagerPage, "Virtual Devices");
|
||||
addPage(mLocalPackagePage, "Installed Packages");
|
||||
addPage(mRemotePackagesPage, "Available Packages");
|
||||
@@ -212,7 +213,6 @@ public class UpdaterWindowImpl {
|
||||
displayPage(0);
|
||||
mPageList.setSelection(0);
|
||||
|
||||
// TODO read and apply settings
|
||||
// TODO read add-on sources from some file
|
||||
setupSources();
|
||||
initializeSettings();
|
||||
|
||||
Reference in New Issue
Block a user