diff options
author | Jeff Johnston | 2018-01-24 17:54:18 +0000 |
---|---|---|
committer | Jeff Johnston | 2018-01-24 17:58:15 +0000 |
commit | 3b91c26043b2b53bf2117dfab5ef61d7b3abfaee (patch) | |
tree | 8301290e6c3f26c8d69263324740e5ce456fa2de | |
parent | e24a04895a4c66b27d4cd09e1372d1a032029171 (diff) | |
download | org.eclipse.cdt-3b91c26043b2b53bf2117dfab5ef61d7b3abfaee.tar.gz org.eclipse.cdt-3b91c26043b2b53bf2117dfab5ef61d7b3abfaee.tar.xz org.eclipse.cdt-3b91c26043b2b53bf2117dfab5ef61d7b3abfaee.zip |
Fix launch config matching for Run as Container Application
- fix LaunchShortcut find launch config method so that if the
active configuration is not enabled for Container build, then
it will look for config with default connection and image
Change-Id: If11865dd43cd2a08a0565b3483523002b0a00613
-rw-r--r-- | launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java index 64cd3a289d8..255a37258af 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java @@ -281,6 +281,22 @@ public class LaunchShortcut implements ILaunchShortcut { imageName = props .getProperty(ContainerCommandLauncher.IMAGE_ID); } + } else { + IDockerConnection[] connections = DockerConnectionManager + .getInstance().getConnections(); + if (connections != null && connections.length > 0) { + connectionUri = connections[0].getUri(); + Preferences prefs = InstanceScope.INSTANCE + .getNode(DockerLaunchUIPlugin.PLUGIN_ID); + imageName = prefs.get(PreferenceConstants.DEFAULT_IMAGE, + null); + if (imageName == null) { + List<IDockerImage> images = connections[0] + .getImages(); + if (images != null && images.size() > 0) + imageName = images.get(0).repoTags().get(0); + } + } } } } @@ -302,9 +318,10 @@ public class LaunchShortcut implements ILaunchShortcut { if (connectionUri != null && connectionUri.equals(config.getAttribute( ILaunchConstants.ATTR_CONNECTION_URI, - connectionUri))) { - if (imageName.equals(config.getAttribute( - ILaunchConstants.ATTR_IMAGE, imageName))) { + (String) null))) { + if (imageName != null && imageName.equals(config + .getAttribute(ILaunchConstants.ATTR_IMAGE, + (String) null))) { candidateConfigs.add(config); } } |