1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 547442 - Launchbar shouldn't set active target for added

Container target

- add new ILaunchTargetManager2 interface which specifies new
  addLaunchTargetNoNotify() method
- change LaunchTargetManager to also implement ILaunchTargetManager2
  interface
- bump to next minor release 2.3.0

Change-Id: I263c44b586a60428971c401d982da2dacd8cd1f0
Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
Jeff Johnston 2019-05-21 16:19:38 -04:00
parent 653bd51fa8
commit 16c7075763
4 changed files with 47 additions and 11 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LaunchBar Core
Bundle-SymbolicName: org.eclipse.launchbar.core;singleton:=true
Bundle-Version: 2.2.3.qualifier
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.eclipse.launchbar.core.internal.Activator
Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.core.runtime,

View file

@ -26,12 +26,13 @@ import org.eclipse.launchbar.core.internal.Activator;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.launchbar.core.target.ILaunchTargetListener;
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
import org.eclipse.launchbar.core.target.ILaunchTargetManager2;
import org.eclipse.launchbar.core.target.ILaunchTargetProvider;
import org.eclipse.launchbar.core.target.TargetStatus;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
public class LaunchTargetManager implements ILaunchTargetManager {
public class LaunchTargetManager implements ILaunchTargetManager, ILaunchTargetManager2 {
private Map<String, Map<String, ILaunchTarget>> targets;
private Map<String, IConfigurationElement> typeElements;
@ -188,7 +189,7 @@ public class LaunchTargetManager implements ILaunchTargetManager {
}
@Override
public ILaunchTarget addLaunchTarget(String typeId, String id) {
public ILaunchTarget addLaunchTargetNoNotify(String typeId, String id) {
initTargets();
Map<String, ILaunchTarget> type = targets.get(typeId);
if (type == null) {
@ -212,19 +213,25 @@ public class LaunchTargetManager implements ILaunchTargetManager {
ILaunchTarget target = new LaunchTarget(typeId, id, child);
type.put(id, target);
prefs.flush();
synchronized (listeners) {
for (ILaunchTargetListener listener : listeners) {
listener.launchTargetAdded(target);
}
}
return target;
} catch (BackingStoreException e) {
Activator.log(e);
return null;
}
}
@Override
public ILaunchTarget addLaunchTarget(String typeId, String id) {
ILaunchTarget target = addLaunchTargetNoNotify(typeId, id);
if (target != null) {
synchronized (listeners) {
for (ILaunchTargetListener listener : listeners) {
listener.launchTargetAdded(target);
}
}
}
return target;
}
@Override
public void removeLaunchTarget(ILaunchTarget target) {

View file

@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2019 Red Hat Inc. 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.target;
/**
* Launch target manager extensions.
*
* @noimplement not to be implemented by clients
*/
public interface ILaunchTargetManager2 {
/**
* Add a launch target with the given typeId, id, and name but no notification.
*
* @param typeId
* type id of the launch target
* @param id
* id for the target.
* @return the created launch target
*/
ILaunchTarget addLaunchTargetNoNotify(String typeId, String id);
}

View file

@ -2,7 +2,7 @@
<feature
id="org.eclipse.launchbar"
label="%featureName"
version="2.2.3.qualifier"
version="2.3.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">