mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-11 02:55:23 +02:00
launchbar: more reasonable launch target defaults
- if new descriptor is created check first of current target is suitable before calling getDefaultTarget - change method getDefaultTarget to return last target from the list rather then first, since list is kept in order of addition, meaning last entry is the most recent Change-Id: I0d9a7760cf52c7dff761f760f3fce05d9ca4c540 Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
parent
e9db9389f2
commit
cec2cbf4dc
1 changed files with 8 additions and 2 deletions
|
@ -474,7 +474,6 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchTargetListene
|
|||
setActiveLaunchTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// last stored target from persistent storage
|
||||
String activeTargetId = getPerDescriptorStore().get(PREF_ACTIVE_LAUNCH_TARGET, null);
|
||||
if (activeTargetId != null) {
|
||||
|
@ -484,6 +483,12 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchTargetListene
|
|||
setActiveLaunchTarget(storedTarget);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// current active target, check if it is supported
|
||||
if (activeLaunchTarget != null && supportsTarget(activeLaunchDesc, activeLaunchTarget)) {
|
||||
setActiveLaunchTarget(activeLaunchTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// default target for descriptor
|
||||
setActiveLaunchTarget(getDefaultLaunchTarget(activeLaunchDesc));
|
||||
|
@ -721,7 +726,8 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchTargetListene
|
|||
|
||||
private ILaunchTarget getDefaultLaunchTarget(ILaunchDescriptor descriptor) {
|
||||
List<ILaunchTarget> targets = getLaunchTargets(descriptor);
|
||||
return targets.isEmpty() ? ILaunchTarget.NULL_TARGET : targets.get(0);
|
||||
// chances are that better target is most recently added, rather then the oldest
|
||||
return targets.isEmpty() ? ILaunchTarget.NULL_TARGET : targets.get(targets.size()-1);
|
||||
}
|
||||
|
||||
public ILaunchConfiguration getActiveLaunchConfiguration() throws CoreException {
|
||||
|
|
Loading…
Add table
Reference in a new issue