mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 03:35:37 +02:00
Bug 440112 Fix priority order for launchConfigProviders.
Also provides the default launch descriptor as API to allow other descriptor types to reuse it. Change-Id: Ifd9f5d9a22d5752e8c139ec4cc37ac181b245ec9 Reviewed-on: https://git.eclipse.org/r/30254 Reviewed-by: Elena Laskavaia <elaskavaia.cdt@gmail.com> Tested-by: Elena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
parent
d8154bd340
commit
bdc8c18df1
4 changed files with 30 additions and 38 deletions
|
@ -8,18 +8,16 @@
|
|||
* Contributors:
|
||||
* Doug Schaefer
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launchbar.core.internal;
|
||||
package org.eclipse.cdt.launchbar.core;
|
||||
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
public class DefaultLaunchDescriptor implements ILaunchDescriptor {
|
||||
|
||||
private final DefaultLaunchDescriptorType type;
|
||||
private final ILaunchDescriptorType type;
|
||||
private final ILaunchConfiguration config;
|
||||
|
||||
public DefaultLaunchDescriptor(DefaultLaunchDescriptorType type, ILaunchConfiguration config) {
|
||||
public DefaultLaunchDescriptor(ILaunchDescriptorType type, ILaunchConfiguration config) {
|
||||
this.type = type;
|
||||
this.config = config;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.eclipse.cdt.launchbar.core.internal;
|
||||
|
||||
import org.eclipse.cdt.launchbar.core.DefaultLaunchDescriptor;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.eclipse.cdt.launchbar.core.internal;
|
||||
|
||||
import org.eclipse.cdt.launchbar.core.DefaultLaunchDescriptor;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;
|
||||
|
|
|
@ -456,21 +456,37 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
|||
@Override
|
||||
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
|
||||
try {
|
||||
boolean added = false;
|
||||
// TODO filter by launch configuration type
|
||||
|
||||
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
|
||||
// TODO filter by launch configuration type to avoid loading plug-ins
|
||||
for (ILaunchDescriptorType descriptorType : descriptorTypes) {
|
||||
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptorType.getId());
|
||||
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
|
||||
if (configProvider.launchConfigurationAdded(configuration)) {
|
||||
added = true;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
launchObjectAdded(configuration);
|
||||
// No one claimed it, send it through the descriptorTypes
|
||||
launchObjectAdded(configuration);
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
|
||||
try {
|
||||
// TODO filter by launch configuration type
|
||||
for (ILaunchDescriptorType descriptorType : descriptorTypes) {
|
||||
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptorType.getId());
|
||||
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
|
||||
if (configProvider.launchConfigurationRemoved(configuration)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launchObjectRemoved(configuration);
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e.getStatus());
|
||||
}
|
||||
|
@ -478,31 +494,7 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
|||
|
||||
@Override
|
||||
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
|
||||
try {
|
||||
boolean removed = false;
|
||||
// TODO filter by launch configuration type
|
||||
|
||||
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
|
||||
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
|
||||
if (configProvider.launchConfigurationRemoved(configuration)) {
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!removed) {
|
||||
launchObjectRemoved(configuration);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e.getStatus());
|
||||
}
|
||||
// Nothing to do on changes
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue