am 61835849: SDK Updater: Cleanup a bunch of todos
Merge commit '6183584988e1de0cb32e560666c4c275c729e192' * commit '6183584988e1de0cb32e560666c4c275c729e192': SDK Updater: Cleanup a bunch of todos
This commit is contained in:
@@ -180,9 +180,11 @@ public final class SdkManager {
|
||||
writer.write(String.format("0x%04x\n", i));
|
||||
}
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the content of the SDK.
|
||||
|
||||
@@ -122,7 +122,7 @@ public class PlatformPackage extends Package {
|
||||
|
||||
File platforms = new File(osSdkRoot, SdkConstants.FD_PLATFORMS);
|
||||
File folder = new File(platforms, String.format("android-%s", getVersion())); //$NON-NLS-1$
|
||||
// TODO find similar existing platform in platforms folder
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.sdklib.internal.repository;
|
||||
|
||||
import com.android.prefs.AndroidLocation;
|
||||
import com.android.prefs.AndroidLocation.AndroidLocationException;
|
||||
import com.android.sdklib.ISdkLog;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -68,7 +69,7 @@ public class RepoSources {
|
||||
* Loads all user sources. This <em>replaces</em> all existing user sources
|
||||
* by the ones from the property file.
|
||||
*/
|
||||
public void loadUserSources() {
|
||||
public void loadUserSources(ISdkLog log) {
|
||||
|
||||
// Remove all existing user sources
|
||||
for (Iterator<RepoSource> it = mSources.iterator(); it.hasNext(); ) {
|
||||
@@ -100,14 +101,14 @@ public class RepoSources {
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
// TODO print to log
|
||||
e.printStackTrace();
|
||||
log.error(e, null);
|
||||
|
||||
} catch (AndroidLocationException e) {
|
||||
// TODO print to log
|
||||
e.printStackTrace();
|
||||
log.error(e, null);
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO print to log
|
||||
e.printStackTrace();
|
||||
log.error(e, null);
|
||||
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
@@ -121,8 +122,9 @@ public class RepoSources {
|
||||
|
||||
/**
|
||||
* Saves all the user sources.
|
||||
* @param log
|
||||
*/
|
||||
public void saveUserSources() {
|
||||
public void saveUserSources(ISdkLog log) {
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
String folder = AndroidLocation.getFolder();
|
||||
@@ -144,11 +146,11 @@ public class RepoSources {
|
||||
props.store( fos, "## User Sources for Android tool"); //$NON-NLS-1$
|
||||
|
||||
} catch (AndroidLocationException e) {
|
||||
// TODO print to log
|
||||
e.printStackTrace();
|
||||
log.error(e, null);
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO print to log
|
||||
e.printStackTrace();
|
||||
log.error(e, null);
|
||||
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
try {
|
||||
|
||||
@@ -47,11 +47,6 @@ import org.eclipse.swt.widgets.TreeColumn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/*
|
||||
* TODO list
|
||||
* - load add-on sites from pref
|
||||
* - delete site callback, update pref
|
||||
*/
|
||||
|
||||
public class RemotePackagesPage extends Composite implements ISdkListener {
|
||||
|
||||
@@ -260,18 +255,12 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
|
||||
mTreeViewerSources.setExpandedState(pkg, true);
|
||||
for (Object archive : provider.getChildren(pkg)) {
|
||||
if (archive instanceof Archive) {
|
||||
if (((Archive) archive).isCompatible()) {
|
||||
mTreeViewerSources.setChecked(archive, true);
|
||||
} else {
|
||||
mTreeViewerSources.setChecked(archive, false);
|
||||
// TODO change the item image to mark it incompatible
|
||||
}
|
||||
mTreeViewerSources.setChecked(archive, ((Archive) archive).isCompatible());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onInstallSelectedArchives() {
|
||||
|
||||
ArrayList<Archive> archives = new ArrayList<Archive>();
|
||||
for (Object element : mTreeViewerSources.getCheckedElements()) {
|
||||
if (element instanceof Archive) {
|
||||
@@ -292,7 +281,7 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
|
||||
boolean changed = false;
|
||||
|
||||
ISelection sel = mTreeViewerSources.getSelection();
|
||||
if (sel instanceof ITreeSelection) {
|
||||
if (mUpdaterData != null && sel instanceof ITreeSelection) {
|
||||
for (Object c : ((ITreeSelection) sel).toList()) {
|
||||
if (c instanceof RepoSource && ((RepoSource) c).isUserSource()) {
|
||||
RepoSource source = (RepoSource) c;
|
||||
|
||||
@@ -219,7 +219,7 @@ class UpdaterData {
|
||||
try {
|
||||
mAvdManager.reloadAvds();
|
||||
} catch (AndroidLocationException e) {
|
||||
// FIXME
|
||||
mSdkLog.error(e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ class UpdaterData {
|
||||
try {
|
||||
listener.onSdkChange();
|
||||
} catch (Throwable t) {
|
||||
// TODO: log error
|
||||
mSdkLog.error(t, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public class UpdaterWindowImpl {
|
||||
* Called by the main loop when the window has been disposed.
|
||||
*/
|
||||
private void dispose() {
|
||||
mUpdaterData.getSources().saveUserSources();
|
||||
mUpdaterData.getSources().saveUserSources(mUpdaterData.getSdkLog());
|
||||
}
|
||||
|
||||
// --- page switching ---
|
||||
@@ -325,7 +325,7 @@ public class UpdaterWindowImpl {
|
||||
}
|
||||
|
||||
// Load user sources
|
||||
sources.loadUserSources();
|
||||
sources.loadUserSources(mUpdaterData.getSdkLog());
|
||||
|
||||
mRemotePackagesPage.onSdkChange();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user