1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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
This commit is contained in:
Jeff Johnston 2018-01-24 12:54:18 -05:00
parent e24a04895a
commit 3b91c26043

View file

@ -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);
}
}