From 3b91c26043b2b53bf2117dfab5ef61d7b3abfaee Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 24 Jan 2018 12:54:18 -0500 Subject: 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 --- .../internal/docker/launcher/LaunchShortcut.java | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'launch/org.eclipse.cdt.docker.launcher') 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 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); } } -- cgit v1.2.3