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

Add a bit of history to config selections.

This commit is contained in:
Doug Schaefer 2014-06-23 11:01:57 -04:00
parent a287a76c34
commit 92aea028d9

View file

@ -43,7 +43,7 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
private List<Listener> listeners = new LinkedList<>(); private List<Listener> listeners = new LinkedList<>();
private List<ProviderExtensionDescriptor> providers = new ArrayList<>(); private List<ProviderExtensionDescriptor> providers = new ArrayList<>();
private Map<String, ILaunchConfigurationDescriptor> configDescs = new HashMap<>(); private Map<String, ILaunchConfigurationDescriptor> configDescs = new HashMap<>();
private ILaunchConfigurationDescriptor activeConfigDesc; private ILaunchConfigurationDescriptor lastConfigDesc, activeConfigDesc;
private ILaunchMode[] launchModes; private ILaunchMode[] launchModes;
private ILaunchMode activeLaunchMode; private ILaunchMode activeLaunchMode;
@ -201,6 +201,7 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
public void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException { public void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException {
if (activeConfigDesc == configDesc) if (activeConfigDesc == configDesc)
return; return;
lastConfigDesc = activeConfigDesc;
activeConfigDesc = configDesc; activeConfigDesc = configDesc;
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
@ -283,10 +284,15 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
// Fix up the active config if this one was it // Fix up the active config if this one was it
if (activeConfigDesc.equals(configDesc)) { if (activeConfigDesc.equals(configDesc)) {
try { try {
if (configDescs.isEmpty()) if (configDescs.isEmpty()) {
setActiveLaunchConfigurationDescriptor(null); setActiveLaunchConfigurationDescriptor(null);
else } else if (lastConfigDesc != null) {
setActiveLaunchConfigurationDescriptor(lastConfigDesc);
// Clear out the last desc since we just used it
lastConfigDesc = null;
} else {
setActiveLaunchConfigurationDescriptor(configDescs.values().iterator().next()); setActiveLaunchConfigurationDescriptor(configDescs.values().iterator().next());
}
} catch (CoreException e) { } catch (CoreException e) {
// TODO log // TODO log
e.printStackTrace(); e.printStackTrace();