mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-12 11:35:21 +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:
parent
32a1b3134c
commit
93a926385f
5 changed files with 52 additions and 1 deletions
|
@ -52,4 +52,15 @@ public class DefaultLaunchConfigProvider implements ILaunchConfigurationProvider
|
||||||
// nothing to do
|
// 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,21 @@ public interface ILaunchConfigurationProvider {
|
||||||
*/
|
*/
|
||||||
boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException;
|
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
|
* A launch descriptor has been removed. Remove any launch configurations that were
|
||||||
* created for it.
|
* created for it.
|
||||||
|
@ -99,4 +114,5 @@ public interface ILaunchConfigurationProvider {
|
||||||
*/
|
*/
|
||||||
void launchTargetRemoved(IRemoteConnection target) throws CoreException;
|
void launchTargetRemoved(IRemoteConnection target) throws CoreException;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,17 @@ public abstract class PerTargetLaunchConfigProvider extends AbstractLaunchConfig
|
||||||
return false;
|
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
|
@Override
|
||||||
public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
|
public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
|
||||||
configMap.remove(descriptor);
|
configMap.remove(descriptor);
|
||||||
|
|
|
@ -45,4 +45,8 @@ public class ProjectLaunchDescriptor extends PlatformObject implements ILaunchDe
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getName(); // for debugging purposes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -745,6 +745,7 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
|
||||||
for (LaunchDescriptorTypeInfo descTypeInfo : orderedDescriptorTypes) {
|
for (LaunchDescriptorTypeInfo descTypeInfo : orderedDescriptorTypes) {
|
||||||
for (LaunchConfigProviderInfo providerInfo : configProviders.get(descTypeInfo.getId())) {
|
for (LaunchConfigProviderInfo providerInfo : configProviders.get(descTypeInfo.getId())) {
|
||||||
try {
|
try {
|
||||||
|
providerInfo.getProvider().launchConfigurationAdded(configuration);
|
||||||
if (providerInfo.getProvider().ownsLaunchConfiguration(configuration)) {
|
if (providerInfo.getProvider().ownsLaunchConfiguration(configuration)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -781,7 +782,15 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
|
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() {
|
public void dispose() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue