1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-11 19:15:22 +02:00

launch bar: API for config added/changed

we missing API to notify provider that configs are added/changed.
it required to keep internal provider map in sync, i.e. restore
the state of config/descriptor map on startup for example.

Change-Id: I3af24a21d5d41084f85731f6da2f7aca2df81f1c
This commit is contained in:
Alena Laskavaia 2015-05-26 13:05:56 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 32a1b3134c
commit 93a926385f
5 changed files with 52 additions and 1 deletions

View file

@ -52,4 +52,15 @@ public class DefaultLaunchConfigProvider implements ILaunchConfigurationProvider
// nothing to do
}
@Override
public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
// catch any left over configs
return true;
}
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
// catch any left over configs
return true;
}
}

View file

@ -81,6 +81,21 @@ public interface ILaunchConfigurationProvider {
*/
boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException;
/**
* A launch configuration has been added. Provider can inspect it and associate with internal map.
* Provider should make sure it owns this launch configuration or it can modify it to take over.
*
* @return true of provider owns this launch configuration
*/
boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException;
/**
* A launch configuration has been changed. Provider can inspect it to re-evaluate its internal map.
* Provider should make sure it owns this launch configuration or it can modify it to take over.
*
* @return true of provider owns this launch configuration
*/
boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException;
/**
* A launch descriptor has been removed. Remove any launch configurations that were
* created for it.
@ -99,4 +114,5 @@ public interface ILaunchConfigurationProvider {
*/
void launchTargetRemoved(IRemoteConnection target) throws CoreException;
}

View file

@ -83,6 +83,17 @@ public abstract class PerTargetLaunchConfigProvider extends AbstractLaunchConfig
return false;
}
@Override
public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
// TODO re-create map
return false;
}
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
return false;
}
@Override
public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
configMap.remove(descriptor);

View file

@ -45,4 +45,8 @@ public class ProjectLaunchDescriptor extends PlatformObject implements ILaunchDe
return type;
}
@Override
public String toString() {
return getName(); // for debugging purposes
}
}

View file

@ -745,6 +745,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
for (LaunchDescriptorTypeInfo descTypeInfo : orderedDescriptorTypes) {
for (LaunchConfigProviderInfo providerInfo : configProviders.get(descTypeInfo.getId())) {
try {
providerInfo.getProvider().launchConfigurationAdded(configuration);
if (providerInfo.getProvider().ownsLaunchConfiguration(configuration)) {
return;
}
@ -781,7 +782,15 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
@Override
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
// Nothing to do on changes
for (LaunchDescriptorTypeInfo descTypeInfo : orderedDescriptorTypes) {
for (LaunchConfigProviderInfo providerInfo : configProviders.get(descTypeInfo.getId())) {
try {
providerInfo.getProvider().launchConfigurationChanged(configuration);
} catch (Throwable e) {
Activator.log(e);
}
}
}
}
public void dispose() {