mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Fix Connection drop-down in Run Image Launch configuration
- drop-down doesn't cause Apply button to activate when changing Connections from previous connection - fix setting of default connectionName to avoid NPE - move setting of connectionURI when user changes drop-down - add check in isvalid() to verify image exists in connection - reload images when changing connection and ignore parent images Change-Id: I9dbc8828a6e6321e9cd1392d4e8c4dbdf2a954db
This commit is contained in:
parent
3e4e14f0d6
commit
8a2fd3307b
3 changed files with 26 additions and 10 deletions
|
@ -55,7 +55,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
|||
private List directoriesList;
|
||||
private String imageName;
|
||||
private String connectionName;
|
||||
private String connectionUri;
|
||||
private String connectionUri = "";
|
||||
private Boolean keepValue;
|
||||
private Boolean stdinValue;
|
||||
private IDockerConnection connection;
|
||||
|
@ -77,11 +77,12 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
|||
if (connection != null)
|
||||
connection.removeImageListener(containerTab);
|
||||
connection = connections[index];
|
||||
if (!connectionName.equals(connection.getName()))
|
||||
updateLaunchConfigurationDialog();
|
||||
connectionName = connection.getName();
|
||||
connectionUri = connection.getUri();
|
||||
connection.addImageListener(containerTab);
|
||||
if (!connectionName.equals(connection.getName())) {
|
||||
updateLaunchConfigurationDialog();
|
||||
initializeImageCombo();
|
||||
}
|
||||
connectionName = connection.getName();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -321,15 +322,13 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
|||
defaultIndex = i;
|
||||
}
|
||||
if (defaultIndex < 0) {
|
||||
setWarningMessage(Messages.bind(
|
||||
Messages.ContainerTab_Warning_Connection_Not_Found,
|
||||
connectionUri, connections[0].getName()));
|
||||
defaultIndex = 0;
|
||||
}
|
||||
connectionSelector.setItems(connectionNames);
|
||||
if (connections.length > 0) {
|
||||
connectionSelector.setText(connectionNames[defaultIndex]);
|
||||
connection = connections[defaultIndex];
|
||||
connectionName = connection.getName();
|
||||
connectionUri = connection.getUri();
|
||||
}
|
||||
}
|
||||
|
@ -461,11 +460,26 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
|||
@Override
|
||||
public boolean isValid(ILaunchConfiguration launchConfig) {
|
||||
try {
|
||||
return launchConfig.getAttribute(ILaunchConstants.ATTR_IMAGE,
|
||||
(String) null) != null;
|
||||
String image = launchConfig
|
||||
.getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null);
|
||||
if (image == null)
|
||||
return false;
|
||||
int index = image.lastIndexOf(':'); // $NON-NLS-1$
|
||||
if (index <= 0)
|
||||
return false;
|
||||
if (connection.hasImage(image.substring(0, index),
|
||||
image.substring(index + 1))) {
|
||||
setWarningMessage(null);
|
||||
return true;
|
||||
} else {
|
||||
setWarningMessage(Messages.bind(
|
||||
Messages.ContainerTab_Warning_Image_Not_Found,
|
||||
image, connections[0].getName()));
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,6 +44,7 @@ public class Messages extends NLS {
|
|||
public static String ContainerTab_Error_No_Connections;
|
||||
public static String ContainerTab_Error_No_Images;
|
||||
public static String ContainerTab_Warning_Connection_Not_Found;
|
||||
public static String ContainerTab_Warning_Image_Not_Found;
|
||||
|
||||
public static String Remote_GDB_Debugger_Options;
|
||||
public static String Gdbserver_Settings_Tab_Name;
|
||||
|
|
|
@ -37,6 +37,7 @@ ContainerTab_Error_Reading_Configuration=Error occurred reading the launch confi
|
|||
ContainerTab_Error_No_Connections=No Docker Connections exist
|
||||
ContainerTab_Error_No_Images=No Docker Images exist
|
||||
ContainerTab_Warning_Connection_Not_Found=Docker Connection: {0} for Launch Configuration not found: defaulting to {1}
|
||||
ContainerTab_Warning_Image_Not_Found=Docker Image: {0} is not a valid pulled image in current Connection: {1}
|
||||
|
||||
Remote_GDB_Debugger_Options=Docker Container GDB Debugger Options
|
||||
Gdbserver_Settings_Tab_Name=Gdbserver Settings
|
||||
|
|
Loading…
Add table
Reference in a new issue