Fix for Bug 467930
authorJeff Johnston <jjohnstn@redhat.com>
Thu, 21 May 2015 21:33:26 +0000 (17:33 -0400)
committerJeff Johnston <jjohnstn@redhat.com>
Thu, 21 May 2015 21:33:26 +0000 (17:33 -0400)
- creating a Container launch configuration in Debug Launch
  Configurations View does not work
- problem is that the ContainerTab was not setting the connectionUri
  by default
- also set Remote Attribute which is needed for Container launch
  to properly connect with gdbserver in Docker Container

Change-Id: Ifb25b1cfcc8d4e3ac2c67b60a0072463774b108f

launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java

index d07d8da..c12bc88 100644 (file)
@@ -246,6 +246,9 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
                                        wc.setAttribute(
                                                        IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
                                                        true);
+                                       wc.setAttribute(
+                                                       ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+                                                       IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
                                        wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST,
                                                        job.getIpAddress());
                                        wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT,
index 395bbb8..a85488f 100644 (file)
@@ -410,6 +410,22 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
                                directoriesList.setItems(additionalDirs.toArray(new String[0]));
                        connectionUri = configuration.getAttribute(
                                        ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
+                       int defaultIndex = 0;
+                       connections = DockerConnectionManager.getInstance()
+                                       .getConnections();
+                       if (connections.length > 0) {
+                               if (!connectionUri.equals("")) { //$NON-NLS-1$
+                                       String[] connectionNames = new String[connections.length];
+                                       for (int i = 0; i < connections.length; ++i) {
+                                               connectionNames[i] = connections[i].getName();
+                                               if (connections[i].getUri().equals(connectionUri))
+                                                       defaultIndex = i;
+                                       }
+                                       connectionSelector.select(defaultIndex);
+                               } else {
+                                       connectionUri = connections[0].getUri();
+                               }
+                       }
                        imageName = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE,
                                        "");
                        imageCombo.setText(imageName);