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:
Raphael
2009-06-11 15:55:42 -07:00
parent 0266592783
commit 38ea6d2afe
5 changed files with 30 additions and 30 deletions

View File

@@ -44,13 +44,12 @@ public class AvdManagerPage extends Composite implements ISdkListener {
/** /**
* Create the composite. * Create the composite.
* @param parent The parent of the composite. * @param parent The parent of the composite.
* @param updaterData An instance of {@link UpdaterData}. If null, a local * @param updaterData An instance of {@link UpdaterData}.
* one will be allocated just to help with the SWT Designer.
*/ */
public AvdManagerPage(Composite parent, UpdaterData updaterData) { public AvdManagerPage(Composite parent, UpdaterData updaterData) {
super(parent, SWT.BORDER); super(parent, SWT.BORDER);
mUpdaterData = updaterData != null ? updaterData : new UpdaterData(); mUpdaterData = updaterData;
mUpdaterData.addListeners(this); mUpdaterData.addListeners(this);
createContents(this); createContents(this);
@@ -92,7 +91,7 @@ public class AvdManagerPage extends Composite implements ISdkListener {
} }
public void run() { public void run() {
//onDelete(); //TODO onDelete();
} }
}); });
} }

View File

@@ -75,14 +75,12 @@ public class LocalPackagesPage extends Composite implements ISdkListener {
/** /**
* Create the composite. * Create the composite.
* @param parent The parent of the composite. * @param parent The parent of the composite.
* @param updaterData An instance of {@link UpdaterData}. If null, a local * @param updaterData An instance of {@link UpdaterData}.
* one will be allocated just to help with the SWT Designer.
*/ */
public LocalPackagesPage(Composite parent, public LocalPackagesPage(Composite parent, UpdaterData updaterData) {
UpdaterData updaterData) {
super(parent, SWT.BORDER); super(parent, SWT.BORDER);
mUpdaterData = updaterData != null ? updaterData : new UpdaterData(); mUpdaterData = updaterData;
mUpdaterData.addListeners(this); mUpdaterData.addListeners(this);
createContents(this); createContents(this);

View File

@@ -80,14 +80,12 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
/** /**
* Create the composite. * Create the composite.
* @param parent The parent of the composite. * @param parent The parent of the composite.
* @param updaterData An instance of {@link UpdaterData}. If null, a local * @param updaterData An instance of {@link UpdaterData}.
* one will be allocated just to help with the SWT Designer.
*/ */
RemotePackagesPage(Composite parent, RemotePackagesPage(Composite parent, UpdaterData updaterData) {
UpdaterData updaterData) {
super(parent, SWT.BORDER); super(parent, SWT.BORDER);
mUpdaterData = updaterData != null ? updaterData : new UpdaterData(); mUpdaterData = updaterData;
mUpdaterData.addListeners(this); mUpdaterData.addListeners(this);
createContents(this); createContents(this);

View File

@@ -68,14 +68,6 @@ class UpdaterData {
initSdk(); initSdk();
} }
/**
* default access constructor used by the pages when instantiated by the SWT designer.
*/
UpdaterData() {
mOsSdkRoot = null;
mSdkLog = null;
}
public void setOsSdkRoot(String osSdkRoot) { public void setOsSdkRoot(String osSdkRoot) {
if (mOsSdkRoot == null || mOsSdkRoot.equals(osSdkRoot) == false) { if (mOsSdkRoot == null || mOsSdkRoot.equals(osSdkRoot) == false) {
mOsSdkRoot = osSdkRoot; 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. * @param archives The archives to install. Incompatible ones will be skipped.
*/ */
public void installArchives(final Collection<Archive> archives) { 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 // 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. // 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() { mTaskFactory.start("Installing Archives", new ITask() {
public void run(ITaskMonitor monitor) { 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() { public void updateAll() {
if (mTaskFactory == null) { assert mTaskFactory != null;
throw new IllegalArgumentException("Task Factory is null");
}
mTaskFactory.start("Update Archives", new ITask() { mTaskFactory.start("Update Archives", new ITask() {
public void run(ITaskMonitor monitor) { public void run(ITaskMonitor monitor) {
@@ -277,17 +274,25 @@ class UpdaterData {
monitor.setDescription("Refresh sources"); monitor.setDescription("Refresh sources");
refreshSources(true, monitor.createSubMonitor(1)); 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 * @param forceFetching When true, load sources that haven't been loaded yet. When
* false, only refresh sources that have been loaded yet. * false, only refresh sources that have been loaded yet.
*/ */
public void refreshSources(final boolean forceFetching, ITaskMonitor monitor) { public void refreshSources(final boolean forceFetching, ITaskMonitor monitor) {
assert mTaskFactory != null;
ITask task = new ITask() { ITask task = new ITask() {
public void run(ITaskMonitor monitor) { public void run(ITaskMonitor monitor) {
ArrayList<RepoSource> sources = mSources.getSources(); ArrayList<RepoSource> sources = mSources.getSources();

View File

@@ -100,7 +100,6 @@ public class UpdaterWindowImpl {
*/ */
protected void createContents() { protected void createContents() {
mAndroidSdkUpdater = new Shell(); mAndroidSdkUpdater = new Shell();
setWindowImage(mAndroidSdkUpdater);
mAndroidSdkUpdater.addDisposeListener(new DisposeListener() { mAndroidSdkUpdater.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
onAndroidSdkUpdaterDispose(); //$hide$ (hide from SWT designer) onAndroidSdkUpdaterDispose(); //$hide$ (hide from SWT designer)
@@ -204,6 +203,8 @@ public class UpdaterWindowImpl {
mUpdaterData.setTaskFactory(mTaskFactory); mUpdaterData.setTaskFactory(mTaskFactory);
mUpdaterData.setImageFactory(new ImageFactory(getShell().getDisplay())); mUpdaterData.setImageFactory(new ImageFactory(getShell().getDisplay()));
setWindowImage(mAndroidSdkUpdater);
addPage(mAvdManagerPage, "Virtual Devices"); addPage(mAvdManagerPage, "Virtual Devices");
addPage(mLocalPackagePage, "Installed Packages"); addPage(mLocalPackagePage, "Installed Packages");
addPage(mRemotePackagesPage, "Available Packages"); addPage(mRemotePackagesPage, "Available Packages");
@@ -212,7 +213,6 @@ public class UpdaterWindowImpl {
displayPage(0); displayPage(0);
mPageList.setSelection(0); mPageList.setSelection(0);
// TODO read and apply settings
// TODO read add-on sources from some file // TODO read add-on sources from some file
setupSources(); setupSources();
initializeSettings(); initializeSettings();