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 List directoriesList;
|
||||||
private String imageName;
|
private String imageName;
|
||||||
private String connectionName;
|
private String connectionName;
|
||||||
private String connectionUri;
|
private String connectionUri = "";
|
||||||
private Boolean keepValue;
|
private Boolean keepValue;
|
||||||
private Boolean stdinValue;
|
private Boolean stdinValue;
|
||||||
private IDockerConnection connection;
|
private IDockerConnection connection;
|
||||||
|
@ -77,11 +77,12 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
connection.removeImageListener(containerTab);
|
connection.removeImageListener(containerTab);
|
||||||
connection = connections[index];
|
connection = connections[index];
|
||||||
if (!connectionName.equals(connection.getName()))
|
|
||||||
updateLaunchConfigurationDialog();
|
|
||||||
connectionName = connection.getName();
|
|
||||||
connectionUri = connection.getUri();
|
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;
|
defaultIndex = i;
|
||||||
}
|
}
|
||||||
if (defaultIndex < 0) {
|
if (defaultIndex < 0) {
|
||||||
setWarningMessage(Messages.bind(
|
|
||||||
Messages.ContainerTab_Warning_Connection_Not_Found,
|
|
||||||
connectionUri, connections[0].getName()));
|
|
||||||
defaultIndex = 0;
|
defaultIndex = 0;
|
||||||
}
|
}
|
||||||
connectionSelector.setItems(connectionNames);
|
connectionSelector.setItems(connectionNames);
|
||||||
if (connections.length > 0) {
|
if (connections.length > 0) {
|
||||||
connectionSelector.setText(connectionNames[defaultIndex]);
|
connectionSelector.setText(connectionNames[defaultIndex]);
|
||||||
connection = connections[defaultIndex];
|
connection = connections[defaultIndex];
|
||||||
|
connectionName = connection.getName();
|
||||||
connectionUri = connection.getUri();
|
connectionUri = connection.getUri();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,11 +460,26 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(ILaunchConfiguration launchConfig) {
|
public boolean isValid(ILaunchConfiguration launchConfig) {
|
||||||
try {
|
try {
|
||||||
return launchConfig.getAttribute(ILaunchConstants.ATTR_IMAGE,
|
String image = launchConfig
|
||||||
(String) null) != null;
|
.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) {
|
} catch (CoreException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class Messages extends NLS {
|
||||||
public static String ContainerTab_Error_No_Connections;
|
public static String ContainerTab_Error_No_Connections;
|
||||||
public static String ContainerTab_Error_No_Images;
|
public static String ContainerTab_Error_No_Images;
|
||||||
public static String ContainerTab_Warning_Connection_Not_Found;
|
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 Remote_GDB_Debugger_Options;
|
||||||
public static String Gdbserver_Settings_Tab_Name;
|
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_Connections=No Docker Connections exist
|
||||||
ContainerTab_Error_No_Images=No Docker Images 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_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
|
Remote_GDB_Debugger_Options=Docker Container GDB Debugger Options
|
||||||
Gdbserver_Settings_Tab_Name=Gdbserver Settings
|
Gdbserver_Settings_Tab_Name=Gdbserver Settings
|
||||||
|
|
Loading…
Add table
Reference in a new issue