mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
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
This commit is contained in:
parent
6b9042e694
commit
9cf1f0625e
2 changed files with 13 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue