# HG changeset patch # User Ed Swartz # Date 1260549714 21600 # Node ID 557efa279676c19caafe928746de43296829f079 # Parent d13345e153e8c7c8f58dac0b7eaa10b008932019 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. diff -r d13345e153e8 -r 557efa279676 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties --- 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 diff -r d13345e153e8 -r 557efa279676 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java --- 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 pair = (Pair) 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 pair) { for (TreeNode treeNode : treeNodes) { Object value = treeNode.getValue(); @@ -576,6 +584,7 @@ return null; } + @SuppressWarnings("unchecked") protected void testService() { Map settings = connectionFactory.getSettingsFromUI(); boolean newConnection = connection == null || !connectionType.equals(connection.getConnectionType()); diff -r d13345e153e8 -r 557efa279676 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java --- 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); } diff -r d13345e153e8 -r 557efa279676 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/RemoteConnectedService.java --- /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. + *

+ * 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 listeners; + private IStatus currentStatus; + /** + * + */ + public RemoteConnectedService(IService service) { + this.service = service; + listeners = new ListenerList(); + 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() { + + public void fire(IStatusChangedListener listener) { + listener.statusChanged(getStatus()); + } + }); + } +} diff -r d13345e153e8 -r 557efa279676 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java --- 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); } diff -r d13345e153e8 -r 557efa279676 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java --- 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); }