--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/installpackages/InstallPackages.java Thu Apr 08 15:26:35 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/installpackages/InstallPackages.java Fri Apr 09 13:45:03 2010 -0500
@@ -33,10 +33,12 @@
import org.eclipse.core.runtime.*;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osgi.service.datalocation.Location;
+import org.osgi.framework.Version;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
@@ -120,7 +122,7 @@
Resource r = factory.createResource(xmlURI);
r.load(null);
- EList contents = r.getContents();
+ EList<EObject> contents = r.getContents();
DocumentRoot root = (DocumentRoot) contents.get(0);
PackagesType packages = root.getPackages();
@@ -241,4 +243,14 @@
}
return ""; //$NON-NLS-1$
}
+
+ public static String formatSDKVersion(Version v) {
+ if (v.getMicro() != 0)
+ return v.toString();
+ StringBuffer sb = new StringBuffer();
+ sb.append(v.getMajor());
+ sb.append('.');
+ sb.append(v.getMinor());
+ return sb.toString();
+ }
}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractPackageInstallerProvider.java Thu Apr 08 15:26:35 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractPackageInstallerProvider.java Fri Apr 09 13:45:03 2010 -0500
@@ -173,7 +173,7 @@
Set<String> sdkFamilyNames = new HashSet<String>();
packageList = packages.getAvailablePackageList();
if (packageList == null)
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
for (PackageType packageType : packageList) {
String sdkFamily = packageType.getSdkFamily();
sdkFamilyNames.add(sdkFamily);
@@ -183,6 +183,7 @@
return sdkFamilyNameList;
}
+ @SuppressWarnings("unchecked")
public List<Version> getVersions(String familyName) {
Set<Version> versions = new HashSet<Version>();
for (PackageType packageType : packageList) {
@@ -197,6 +198,7 @@
}
List<Version> versionList = new ArrayList<Version>(versions);
Collections.sort(versionList);
+ Collections.reverse(versionList);
return versionList;
}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Thu Apr 08 15:26:35 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Fri Apr 09 13:45:03 2010 -0500
@@ -25,8 +25,8 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -83,26 +83,27 @@
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.Version;
+import com.nokia.carbide.installpackages.InstallPackages;
import com.nokia.carbide.remoteconnections.Messages;
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
import com.nokia.carbide.remoteconnections.interfaces.AbstractConnectedService2;
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener;
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory.IValidationErrorReporter;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.IEditingUI;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.ISettingsChangedListener;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.interfaces.IService2;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory.IValidationErrorReporter;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.IEditingUI;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.ISettingsChangedListener;
import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller;
import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller.IPackageContents;
-import com.nokia.carbide.remoteconnections.interfaces.IService;
-import com.nokia.carbide.remoteconnections.interfaces.IService2;
import com.nokia.carbide.remoteconnections.internal.registry.Registry;
import com.nokia.cpp.internal.api.utils.core.Check;
import com.nokia.cpp.internal.api.utils.core.FileUtils;
@@ -321,7 +322,7 @@
public String getText(Object element) {
Check.checkState(element instanceof Pair);
Pair<String, Version> pair = (Pair) element;
- return MessageFormat.format("{0} {1}", pair.first, pair.second); //$NON-NLS-1$
+ return MessageFormat.format("{0} {1}", pair.first, InstallPackages.formatSDKVersion(pair.second)); //$NON-NLS-1$
}
});
deviceOSComboViewer.getControl().setToolTipText(Messages.getString("ConnectionSettingsPage.DeviceOSComboToolTip")); //$NON-NLS-1$
@@ -447,6 +448,8 @@
String label = ((IRemoteAgentInstaller) value).getLabel();
return label == null ? Messages.getString("ConnectionSettingsPage.UnlabeledPackageLabel") : label; //$NON-NLS-1$
}
+ if (value instanceof Version)
+ return InstallPackages.formatSDKVersion((Version) value);
return value.toString();
}
@@ -704,7 +707,6 @@
installerTreeViewer.setContentProvider(new TreeNodeContentProvider());
installerTreeViewer.setInput(treeNodes);
installerTreeViewer.refresh(true);
- installerTreeViewer.expandAll();
if (treeNodes.length == 0) {
String errorText;
@@ -746,6 +748,7 @@
if (input instanceof TreeNode[]) {
TreeNode node = findTreeNodeForPair((TreeNode[]) input, pair);
if (node != null) {
+ installerTreeViewer.collapseAll();
installerTreeViewer.setSelection(new StructuredSelection(node));
}
}
@@ -893,7 +896,7 @@
}
private synchronized TreeNode[] createTreeNodes() {
- Map<String, TreeNode> sdkFamilyToNodes = new HashMap<String, TreeNode>();
+ Map<String, TreeNode> sdkFamilyToNodes = new LinkedHashMap<String, TreeNode>();
for (IRemoteAgentInstallerProvider installerProvider : installerProviders) {
List<String> familyNames = installerProvider.getSDKFamilyNames(null);
for (String familyName : familyNames) {