daily merge RCL_2_4
authorfturovic <frank.turovich@nokia.com>
Thu, 11 Feb 2010 15:09:23 -0600
branchRCL_2_4
changeset 940 949823a0e5df
parent 939 47d3ca29d054 (current diff)
parent 937 c2a0b0241151 (diff)
child 941 e90e6ea44529
child 943 00971b52d4a3
daily merge
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ServiceTester.java	Thu Feb 11 15:08:43 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ServiceTester.java	Thu Feb 11 15:09:23 2010 -0600
@@ -94,7 +94,7 @@
 			public void run() {
 				while (true) {
 					Collection<Set<AbstractConnectedService2>> csSetsByResource = 
-						createConnectedServiceSetsByResource(registry);
+						createConnectedServiceSetsByResource(new HashSet<AbstractConnectedService2>(registry));
 					for (Set<AbstractConnectedService2> set : csSetsByResource) {
 						Collection<Set<AbstractConnectedService2>> csSetsByService = 
 							createConnectedServiceSetsByService(set);
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Feb 11 15:08:43 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Feb 11 15:09:23 2010 -0600
@@ -517,6 +517,7 @@
 	
 	public ISelectedConnectionInfo ensureConnection(String id, IService service) throws CoreException {
 		Check.checkArg(service);
+		final boolean wasCurrentConnection = id.equals(CURRENT_CONNECTION_ID);
 		final IConnection[] connectionHolder = { findConnection(id) };
 		final String[] storableIdHolder = { id };
 		if (!isCompatibleConnection(connectionHolder[0], service)) {
@@ -526,6 +527,10 @@
 						Logging.newStatus(RemoteConnectionsActivator.getDefault(), IStatus.ERROR, 
 								Messages.getString("Registry.NoCompatibleConnectionMsg"))); //$NON-NLS-1$
 			}
+			else if (wasCurrentConnection && !connectionHolder[0].getIdentifier().equals(CURRENT_CONNECTION_ID)) {
+				setCurrentConnection(connectionHolder[0]);
+				storableIdHolder[0] = CURRENT_CONNECTION_ID;
+			}
 		}
 		return new ISelectedConnectionInfo() {
 			public String getStorableId() {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Feb 11 15:08:43 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Feb 11 15:09:23 2010 -0600
@@ -981,10 +981,26 @@
 				BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
 				String overallOutput = null;
 				String stdErrLine = null;
-				try { 
-					while ((stdErrLine = br.readLine()) != null) { 
-						overallOutput += stdErrLine; 
+				try {
+
+					// Only try for 10 seconds then bail in case Raptor hangs
+					int maxTries = 20;
+					int numTries = 0;
+					while (numTries < maxTries) {
+						try {
+							Thread.sleep(500);
+						} catch (InterruptedException e) {
+							// ignore
+						}
+						if (br.ready()) {
+							while ((stdErrLine = br.readLine()) != null) {
+								overallOutput += stdErrLine;
+							}
+							break;
+						}
+						numTries++;
 					}
+
 				} catch (IOException e) { 
 					e.printStackTrace();
 				}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Thu Feb 11 15:08:43 2010 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Thu Feb 11 15:09:23 2010 -0600
@@ -20,6 +20,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
 
 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
@@ -128,15 +130,28 @@
 	}
 
 	private void showConnectionsView() {
-		RunRunnableWhenWorkbenchVisibleJob.start(new Runnable() {
-			public void run() {
-				// try to show the connections view to start service testers
-				try {
-					WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
-				} catch (PartInitException e) {
+		// avoid deadlock if this called as a result of a launch sequence issuing a "select connection" dialog
+		Shell shell = WorkbenchUtils.getActiveShell();
+		if (shell == null || !shell.isVisible()) {
+			RunRunnableWhenWorkbenchVisibleJob.start(new Runnable() {
+				public void run() {
+					// try to show the connections view to start service testers
+					try {
+						WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
+					} catch (PartInitException e) {
+					}
 				}
-			}
-		});
+			});
+		} else {
+			Display.getDefault().asyncExec(new Runnable() {
+				public void run() {
+					try {
+						WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
+					} catch (PartInitException e) {
+					}
+				}
+			});
+		}
 	}
 	
 	private void reconcileAsCurrent(IConnection connection) {