Description
Originally posted by @betamaxbandit in #1207
The Gdb Remote launch targets need a clean up.
- Error shown immediately
When the new "GDB Remote TCP" launch target wizard is launched, it immediately shows the error message:
"Hostname or IP must be specified"
This is against Eclipse wizard design guidelines;
Guideline 5.3
Start the wizard with a prompt, not an error message.
https://eclipse-platform.github.io/ui-best-practices/#wizards
- Not allow invalid chars and spaces.
An error should be displayed if the user has chosen an invalid name.
A target name with invalid chars actually gets fixed in ICBuildConfigurationProvider.getCBuildConfigName(IProject, String, IToolChain, String, ILaunchTarget), by calling LaunchTargetUtils.sanitizeName(String).
However I think the launch target wizard should pick this up and not allow Finish until name is valid.
- Not allow duplicate names.
An error should be displayed if the user has chosen a name that already exists.
In my wizard, I handle this:
List fExistingRCarLaunchTargetNames;
In page constructor:
fExistingRCarLaunchTargetNames = getExistingLaunchTargetNames();
/**
* Used to create a cache of existing launch target names so it is quick to check if a new name already exists.
*/
private List<String> getExistingLaunchTargetNames() {
List<String> retVal = new ArrayList<>();
ILaunchTargetManager manager = RcarLaunchTargetUIPlugin.getService(ILaunchTargetManager.class);
if (manager != null) {
retVal = Arrays.stream(manager.getLaunchTargetsOfType( LAUNCH_TARGET_TYPE_ID))
.map(ILaunchTarget::getId)
.collect(Collectors.toList());
}
return retVal;
}
where LAUNCH_TARGET_TYPE_ID is the type like GDBRemoteSerialLaunchTargetProvider.TYPE_ID or GDBRemoteTCPLaunchTargetProvider.TYPE_ID
and then in a validate method:
if (fIsCreating && fExistingRCarLaunchTargetNames.contains(name)) {
setErrorMessage("A launch target with that name already exists.");
return false;
}
- Not possible to delete
In "GDB Remote Serial" launch target wizard lacks delete button, so once a target is created, it is not possible for the user to delete a target.
It is possible to delete the TCP target however.
I think if the user has the ability to choose a name for something, then they should be allowed to delete it.