mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-07 09:05:24 +02:00
Bug 536889 - Launchbar needs to replace slashes for launch target names
- fix LaunchTargetManager addLaunchTarget to change any slashes in the target name to semi-colons when forming the preference node name to use - fix LaunchTargetManager initTargets method to restore slashes when reading the targets from preference nodes - fix LaunchTargetManager removeLaunchTarget to change any slashes in the target name to semi-colons when removing a preference node corresponding to the launch target id Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
parent
2801712233
commit
a62d2ae89b
1 changed files with 10 additions and 3 deletions
|
@ -40,6 +40,8 @@ public class LaunchTargetManager implements ILaunchTargetManager {
|
||||||
|
|
||||||
private static final String DELIMETER1 = ","; //$NON-NLS-1$
|
private static final String DELIMETER1 = ","; //$NON-NLS-1$
|
||||||
private static final String DELIMETER2 = ":"; //$NON-NLS-1$
|
private static final String DELIMETER2 = ":"; //$NON-NLS-1$
|
||||||
|
private static final String SLASH = "/"; //$NON-NLS-1$
|
||||||
|
private static final String SLASH_REPLACER = ";"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Preferences getTargetsPref() {
|
private Preferences getTargetsPref() {
|
||||||
return InstanceScope.INSTANCE.getNode(Activator.getDefault().getBundle().getSymbolicName())
|
return InstanceScope.INSTANCE.getNode(Activator.getDefault().getBundle().getSymbolicName())
|
||||||
|
@ -70,7 +72,9 @@ public class LaunchTargetManager implements ILaunchTargetManager {
|
||||||
String[] segments = childName.split(DELIMETER1);
|
String[] segments = childName.split(DELIMETER1);
|
||||||
if (segments.length == 2) {
|
if (segments.length == 2) {
|
||||||
String typeId = segments[0];
|
String typeId = segments[0];
|
||||||
String name = segments[1];
|
// Bug 536889 - we need to restore any slashes we changed when creating
|
||||||
|
// the target node so the name will appear correct to the end-user
|
||||||
|
String name = segments[1].replaceAll(SLASH_REPLACER, SLASH);
|
||||||
|
|
||||||
Map<String, ILaunchTarget> type = targets.get(typeId);
|
Map<String, ILaunchTarget> type = targets.get(typeId);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
@ -194,7 +198,9 @@ public class LaunchTargetManager implements ILaunchTargetManager {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Preferences prefs = getTargetsPref();
|
Preferences prefs = getTargetsPref();
|
||||||
String childName = typeId + DELIMETER1 + id;
|
// Bug 536889 - replace any slashes in the id with a replacement character
|
||||||
|
// for the child node name but still leave the id intact for the launch target
|
||||||
|
String childName = typeId + DELIMETER1 + id.replaceAll(SLASH, SLASH_REPLACER);
|
||||||
Preferences child;
|
Preferences child;
|
||||||
if (prefs.nodeExists(childName)) {
|
if (prefs.nodeExists(childName)) {
|
||||||
child = prefs.node(childName);
|
child = prefs.node(childName);
|
||||||
|
@ -233,7 +239,8 @@ public class LaunchTargetManager implements ILaunchTargetManager {
|
||||||
|
|
||||||
// Remove the attribute node
|
// Remove the attribute node
|
||||||
try {
|
try {
|
||||||
getTargetsPref().node(typeId + DELIMETER1 + target.getId()).removeNode();
|
// Bug 536889 - calculate the node name to remove, replacing slashes with a replacement character
|
||||||
|
getTargetsPref().node(typeId + DELIMETER1 + target.getId().replaceAll(SLASH, SLASH_REPLACER)).removeNode();
|
||||||
} catch (BackingStoreException e) {
|
} catch (BackingStoreException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue