1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

Bug 521703 Add name attribute to new targets

This ensure they have at least one attribute to that the child node
persists (empty ones don't).

Change-Id: I3bdc64a07a097882acfcc4995e1d09a0a862b197
This commit is contained in:
Doug Schaefer 2017-08-31 11:34:17 -04:00
parent 3d9e238603
commit 374059131b
2 changed files with 27 additions and 25 deletions

View file

@ -1,16 +1,9 @@
/*******************************************************************************
* Copyright (c) Jan 29, 2016 QNX Software Systems. All Rights Reserved.
*
* You must obtain a written license from and pay applicable license fees to QNX
* Software Systems before you may reproduce, modify or distribute this software,
* or any work that includes all or part of this software. Free development
* licenses are available for evaluation and non-commercial purposes. For more
* information visit [http://licensing.qnx.com] or email licensing@qnx.com.
*
* This file may contain contributions from others. Please review this entire
* file for other proprietary rights or license notices, as well as the QNX
* Development Suite License Guide at [http://licensing.qnx.com/license-guide/]
* for other information.
* Copyright (c) 2016 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.launchbar.core;

View file

@ -192,23 +192,32 @@ public class LaunchTargetManager implements ILaunchTargetManager {
targets.put(typeId, type);
}
Preferences prefs = getTargetsPref();
String childName = typeId + DELIMETER1 + id;
ILaunchTarget target = new LaunchTarget(typeId, id, prefs.node(childName));
type.put(id, target);
try {
prefs.flush();
Preferences prefs = getTargetsPref();
String childName = typeId + DELIMETER1 + id;
Preferences child;
if (prefs.nodeExists(childName)) {
child = prefs.node(childName);
} else {
child = prefs.node(childName);
// set the id so we have at least one attribute to save
child.put("name", id); //$NON-NLS-1$
}
ILaunchTarget target = new LaunchTarget(typeId, id, child);
type.put(id, target);
child.flush();
synchronized (listeners) {
for (ILaunchTargetListener listener : listeners) {
listener.launchTargetAdded(target);
}
}
return target;
} catch (BackingStoreException e) {
Activator.log(e);
return null;
}
synchronized (listeners) {
for (ILaunchTargetListener listener : listeners) {
listener.launchTargetAdded(target);
}
}
return target;
}
@Override