1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-16 12:45:41 +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:
Doug Schaefer 2014-07-22 10:44:46 -04:00 committed by Elena Laskavaia
parent d8154bd340
commit bdc8c18df1
4 changed files with 30 additions and 38 deletions

View file

@ -8,18 +8,16 @@
* Contributors: * Contributors:
* Doug Schaefer * 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; import org.eclipse.debug.core.ILaunchConfiguration;
public class DefaultLaunchDescriptor implements ILaunchDescriptor { public class DefaultLaunchDescriptor implements ILaunchDescriptor {
private final DefaultLaunchDescriptorType type; private final ILaunchDescriptorType type;
private final ILaunchConfiguration config; private final ILaunchConfiguration config;
public DefaultLaunchDescriptor(DefaultLaunchDescriptorType type, ILaunchConfiguration config) { public DefaultLaunchDescriptor(ILaunchDescriptorType type, ILaunchConfiguration config) {
this.type = type; this.type = type;
this.config = config; this.config = config;
} }

View file

@ -1,5 +1,6 @@
package org.eclipse.cdt.launchbar.core.internal; 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.ILaunchBarManager;
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider; import org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider;
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor; import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;

View file

@ -1,5 +1,6 @@
package org.eclipse.cdt.launchbar.core.internal; 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.ILaunchBarManager;
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor; import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType; import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;

View file

@ -456,21 +456,37 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
@Override @Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) { public void launchConfigurationAdded(ILaunchConfiguration configuration) {
try { try {
boolean added = false; // TODO filter by launch configuration type to avoid loading plug-ins
// TODO filter by launch configuration type for (ILaunchDescriptorType descriptorType : descriptorTypes) {
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptorType.getId());
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
for (ILaunchConfigurationProvider configProvider : targetMap.values()) { for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
if (configProvider.launchConfigurationAdded(configuration)) { if (configProvider.launchConfigurationAdded(configuration)) {
added = true; return;
break;
} }
} }
} }
if (!added) { // No one claimed it, send it through the descriptorTypes
launchObjectAdded(configuration); 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) { } catch (CoreException e) {
Activator.log(e.getStatus()); Activator.log(e.getStatus());
} }
@ -478,31 +494,7 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
@Override @Override
public void launchConfigurationChanged(ILaunchConfiguration configuration) { public void launchConfigurationChanged(ILaunchConfiguration configuration) {
// TODO Auto-generated method stub // Nothing to do on changes
}
@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());
}
} }
} }