1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 439833 - Allow Launch Configuration Deletion from Launch Bar

Also a slight refactoring of ILaunchConfigurationProvider for to enable
this.

Change-Id: I3e51e2277ee1a2b8875790d02ab6e5350595c946
Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
Reviewed-on: https://git.eclipse.org/r/30078
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
Tested-by: Hudson CI
This commit is contained in:
Jonathan Williams 2014-07-17 14:42:04 -04:00 committed by Doug Schaefer
parent cc2fe9086b
commit b9764a20a4
3 changed files with 30 additions and 12 deletions

View file

@ -29,10 +29,10 @@ public interface ILaunchConfigurationProvider {
* is properly constructed by sending in a launch object to the launch manager.
*
* @param configuration
* @return
* @return boolean - was the launch configuration added by this provider?
* @throws CoreException
*/
boolean ownsLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException;
boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException;
/**
* Returns the launch configuration type used to launch the descriptor on this target type.
@ -58,8 +58,9 @@ public interface ILaunchConfigurationProvider {
* A launch configuration has been removed.
*
* @param configuration
* @return boolean - was the launch configuration removed by this provider?
* @throws CoreException
*/
void launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException;
boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException;
}

View file

@ -15,7 +15,7 @@ public class DefaultLaunchConfigurationProvider implements ILaunchConfigurationP
}
@Override
public boolean ownsLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException {
public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
// We may own it but return false to let it percolate through to the descriptor type.
return false;
}
@ -37,8 +37,8 @@ public class DefaultLaunchConfigurationProvider implements ILaunchConfigurationP
}
@Override
public void launchConfigurationRemoved(ILaunchConfiguration configation) throws CoreException {
// The descriptor will handle the remove.
public boolean launchConfigurationRemoved(ILaunchConfiguration configation) throws CoreException {
return false;
}
}

View file

@ -456,19 +456,19 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
@Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
try {
boolean owned = false;
boolean added = false;
// TODO filter by launch configuration type
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
if (configProvider.ownsLaunchConfiguration(configuration)) {
owned = true;
if (configProvider.launchConfigurationAdded(configuration)) {
added = true;
break;
}
}
}
if (!owned) {
if (!added) {
launchObjectAdded(configuration);
}
} catch (CoreException e) {
@ -484,8 +484,25 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
@Override
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
// TODO Auto-generated method stub
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());
}
}
}