Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorJeff Johnston2018-05-07 17:53:09 -0400
committerJeff Johnston2018-05-07 17:53:35 -0400
commit9cf1f0625ef6dcd4b6d57d416665b435f6405ca7 (patch)
treee8cafbda9be5e921dcfea274275dc645c180e2f4 /launch
parent6b9042e6941e1fa9a4687bddbe1470c38878194b (diff)
downloadorg.eclipse.cdt-9cf1f0625ef6dcd4b6d57d416665b435f6405ca7.tar.gz
org.eclipse.cdt-9cf1f0625ef6dcd4b6d57d416665b435f6405ca7.tar.xz
org.eclipse.cdt-9cf1f0625ef6dcd4b6d57d416665b435f6405ca7.zip
Bug 533842 - Fix Launchbar for enabled/disabled Docker Connections
- fix problem with launch targets not being set correctly - for ContainerTargetTypeProvider, make init() and changeEvent() synchronized - move the test for ESTABLISHED connection after getImages() in ContainerTargetTypeProvider.init() method so that we don't see the connection as being UNKNOWN - move addConnectionManagerListener() call in init() to be just after we fetch the list of current connections - in ContainerGCCToolChainProvider, make init() and changeEvent() synchronized and move addConnectionManagerListener call to just after connections list are acquired Change-Id: I24880a77755d634e8bce85db4f3354cf5ad7671d
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java12
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java10
2 files changed, 13 insertions, 9 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
index 73b40a4452..f529d427a3 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
@@ -48,7 +48,7 @@ public class ContainerTargetTypeProvider
private ILaunchTargetManager targetManager;
@Override
- public void init(ILaunchTargetManager targetManager) {
+ public synchronized void init(ILaunchTargetManager targetManager) {
this.targetManager = targetManager;
ILaunchBarManager launchbarManager = CDebugCorePlugin
.getService(ILaunchBarManager.class);
@@ -60,14 +60,17 @@ public class ContainerTargetTypeProvider
}
IDockerConnection[] connections = DockerConnectionManager.getInstance()
.getConnections();
+ DockerConnectionManager.getInstance().addConnectionManagerListener(this);
Map<String, IDockerConnection> establishedConnectionMap = new HashMap<>();
Set<String> imageNames = new HashSet<>();
for (IDockerConnection connection : connections) {
+ // Get Images before checking state as the state may be
+ // unknown until a request is made
+ List<IDockerImage> images = connection.getImages();
if (connection
.getState() == EnumDockerConnectionState.ESTABLISHED) {
establishedConnectionMap.put(connection.getUri(), connection);
}
- List<IDockerImage> images = connection.getImages();
for (IDockerImage image : images) {
if (!image.isDangling() && !image.isIntermediateImage()) {
String imageName = "[" //$NON-NLS-1$
@@ -112,8 +115,6 @@ public class ContainerTargetTypeProvider
DockerLaunchUIPlugin.log(e);
}
- DockerConnectionManager.getInstance()
- .addConnectionManagerListener(this);
}
@Override
@@ -123,7 +124,8 @@ public class ContainerTargetTypeProvider
}
@Override
- public void changeEvent(IDockerConnection connection, int type) {
+ public synchronized void changeEvent(IDockerConnection connection,
+ int type) {
ICBuildConfigurationManager mgr = CCorePlugin
.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
index aba09ca8f8..3134e07bac 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
@@ -53,10 +53,13 @@ public class ContainerGCCToolChainProvider
}
@Override
- public void init(IToolChainManager manager) throws CoreException {
+ public synchronized void init(IToolChainManager manager)
+ throws CoreException {
this.toolChainManager = manager;
IDockerConnection[] connections = DockerConnectionManager.getInstance()
.getConnections();
+ DockerConnectionManager.getInstance()
+ .addConnectionManagerListener(this);
Map<String, IDockerConnection> connectionMap = new HashMap<>();
for (IDockerConnection connection : connections) {
connectionMap.put(connection.getUri(), connection);
@@ -87,12 +90,11 @@ public class ContainerGCCToolChainProvider
}
}
- DockerConnectionManager.getInstance()
- .addConnectionManagerListener(this);
}
@Override
- public void changeEvent(IDockerConnection connection, int type) {
+ public synchronized void changeEvent(IDockerConnection connection,
+ int type) {
ICBuildConfigurationManager mgr = CCorePlugin
.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;

Back to the top