Fixes for #10354 (Linux & remote connections). Provide appropriate status for TRK/Tracing when remote connection not impemented. Do not provide installer data for now either.
authorEd Swartz <ed.swartz@nokia.com>
Fri, 11 Dec 2009 10:41:54 -0600
changeset 678 557efa279676
parent 677 d13345e153e8
child 681 0ca8a6b568b1
child 684 8e7900690341
Fixes for #10354 (Linux & remote connections). Provide appropriate status for TRK/Tracing when remote connection not impemented. Do not provide installer data for now either.
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/RemoteConnectedService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Fri Dec 11 09:47:44 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Fri Dec 11 10:41:54 2009 -0600
@@ -17,6 +17,7 @@
 ConnectionSettingsPage.InstallTabLabel=Install remote agents
 ConnectionSettingsPage.NoInstallerDataInfoString=No installer data available.
 ConnectionSettingsPage.NoInstallerDataInfoString2=Server may be down.
+ConnectionSettingsPage.NoInstallerSupport=Installers are currently not supported on this operating system.
 ConnectionSettingsPage.NoSettingsString={0} has no connection settings
 ConnectionSettingsPage.NotTestedStatusString=Status not tested
 ConnectionSettingsPage.PageTitleFmt={0} Settings
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java	Fri Dec 11 09:47:44 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java	Fri Dec 11 10:41:54 2009 -0600
@@ -166,6 +166,7 @@
 		gd_sdkcombo.widthHint = 150;
 		deviceOSComboViewer.getCombo().setLayoutData(gd_sdkcombo);
 		deviceOSComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+			@SuppressWarnings("unchecked")
 			public void selectionChanged(SelectionChangedEvent event) {
 				IStructuredSelection selection = (IStructuredSelection) deviceOSComboViewer.getSelection();
 				Pair<String, Version> pair = (Pair<String, Version>) selection.getFirstElement();
@@ -519,8 +520,14 @@
 				installerTreeViewer.expandAll();
 				
 				if (treeNodes.length == 0) {
-					String errorText = Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString"); //$NON-NLS-1$
-					errorText += "\n" + Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString2"); //$NON-NLS-1$ //$NON-NLS-2$
+					String errorText;
+					// TODO: the actual error condition needs to be recorded... 
+					if (HostOS.IS_UNIX) {
+						errorText = Messages.getString("ConnectionSettingsPage.NoInstallerSupport"); //$NON-NLS-1$
+					} else {
+						errorText = Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString"); //$NON-NLS-1$
+						errorText += "\n" + Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString2"); //$NON-NLS-1$ //$NON-NLS-2$
+					}
 					installerInfoText.setText(errorText);
 				}
 				
@@ -557,6 +564,7 @@
 		}
 	}
 	
+	@SuppressWarnings("unchecked")
 	private TreeNode findTreeNodeForPair(TreeNode[] treeNodes, Pair<String, Version> pair) {
 		for (TreeNode treeNode : treeNodes) {
 			Object value = treeNode.getValue();
@@ -576,6 +584,7 @@
 		return null;
 	}
 
+	@SuppressWarnings("unchecked")
 	protected void testService() {
 		Map<String, String> settings = connectionFactory.getSettingsFromUI();
 		boolean newConnection = connection == null || !connectionType.equals(connection.getConnectionType());
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Fri Dec 11 09:47:44 2009 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Fri Dec 11 10:41:54 2009 -0600
@@ -36,13 +36,13 @@
 		if (service instanceof TracingService &&
 				isCompatibleConnection(getCompatibleTracingConnectionTypeIds(), connection)) {
 			if (HostOS.IS_UNIX)
-				return null;		// TODO: not ported
+				return new RemoteConnectedService(service);		// TODO: not ported
 			return new TracingConnectedService(service, (AbstractSynchronizedConnection) connection);
 		}
 		else if (service instanceof TRKService &&
 				isCompatibleConnection(getCompatibleTRKConnectionTypeIds(), connection)) {
 			if (HostOS.IS_UNIX)
-				return null;		// TODO: not ported
+				return new RemoteConnectedService(service);	// TODO: not ported
 			return new TRKConnectedService(service, (AbstractSynchronizedConnection) connection);
 		}
 		
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/RemoteConnectedService.java	Fri Dec 11 10:41:54 2009 -0600
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+package com.nokia.carbide.trk.support.service;
+
+import org.osgi.framework.Version;
+
+import com.nokia.carbide.remoteconnections.Messages;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.cpp.internal.api.utils.core.IListenerFiring;
+import com.nokia.cpp.internal.api.utils.core.ListenerList;
+
+/**
+ * This is a stub for the TRK and Trace connected services used when the host
+ * does not support Chad's TCF.  This reconciles the fact that a TRK connection publishes
+ * these services, but we cannot actually instantiate them.
+ * <p>
+ * In the future this should find a way to talk to the device over Eclipse TCF or something.
+ */
+public class RemoteConnectedService implements IConnectedService {
+
+	private boolean enabled = true;
+	private final IService service;
+	private IStatus unknownStatus = new IStatus() {
+
+		public IConnectedService getConnectedService() {
+			return RemoteConnectedService.this;
+		}
+
+		public EStatus getEStatus() {
+			return EStatus.UNKNOWN;
+		}
+
+		public String getLongDescription() {
+			return "The device is connected remotely; testing not yet implemented.";
+		}
+
+		public String getShortDescription() {
+			return "Unknown";
+		}
+		
+	};
+	
+	private IStatus noStatus = new IStatus() {
+
+		public IConnectedService getConnectedService() {
+			return RemoteConnectedService.this;
+		}
+
+		public EStatus getEStatus() {
+			return EStatus.UNKNOWN;
+		}
+
+		public String getLongDescription() {
+			return Messages.getString("AbstractConnectedService.UserDisabledMessage");
+		}
+
+		public String getShortDescription() {
+			return Messages.getString("AbstractConnectedService.NoTestingLabel");
+		}
+		
+	};
+	private ListenerList<IStatusChangedListener> listeners;
+	private IStatus currentStatus;
+	/**
+	 * 
+	 */
+	public RemoteConnectedService(IService service) {
+		this.service = service;
+		listeners = new ListenerList<IStatusChangedListener>();
+		currentStatus = noStatus;
+	}
+	public void addStatusChangedListener(IStatusChangedListener listener) {
+		listeners.add(listener);
+	}
+
+	public void dispose() {
+	}
+
+	public IService getService() {
+		return service;
+	}
+
+	public IStatus getStatus() {
+		return currentStatus;
+	}
+
+	public void removeStatusChangedListener(IStatusChangedListener listener) {
+		listeners.remove(listener);
+	}
+
+	public void testStatus() {
+	}
+
+	public void setDeviceOS(String familyName, Version version) {
+	}
+
+	public boolean isEnabled() {
+		return enabled;
+	}
+
+	public void setEnabled(boolean enabled) {
+		this.enabled  = enabled;
+		
+		currentStatus = enabled ? unknownStatus : noStatus;
+				
+		fireListeners();
+	}
+	/**
+	 * 
+	 */
+	private void fireListeners() {
+		listeners.fireListeners(new IListenerFiring<IStatusChangedListener>() {
+			
+			public void fire(IStatusChangedListener listener) {
+				listener.statusChanged(getStatus());
+			}
+		});
+	}
+}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Fri Dec 11 09:47:44 2009 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Fri Dec 11 10:41:54 2009 -0600
@@ -22,6 +22,7 @@
 import com.nokia.carbide.trk.support.Messages;
 import com.nokia.carbide.trk.support.connection.*;
 import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.HostOS;
 
 import java.util.*;
 
@@ -56,6 +57,9 @@
 	}
 
 	public IRemoteAgentInstallerProvider getInstallerProvider() {
+		if (HostOS.IS_UNIX)
+			return null;		// TODO: implement
+
 		return new TRKInstallerProvider(this);
 	}
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Fri Dec 11 09:47:44 2009 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Fri Dec 11 10:41:54 2009 -0600
@@ -23,6 +23,7 @@
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.HostOS;
 
 
 import java.util.Arrays;
@@ -58,6 +59,8 @@
 	}
 
 	public IRemoteAgentInstallerProvider getInstallerProvider() {
+		if (HostOS.IS_UNIX)
+			return null;		// TODO: implement
 		return new TracingInstallerProvider(this);
 	}