mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 05:25:21 +02:00
Do a stop launch when doing a launch active. Remote fixes.
This is the first step towards cleaning up the actions. Also make sure teh remote target provider only acts on remotes of the type it's associated with. Change-Id: Ifb2e39620e7d62b075c3d18dd338694071dc5720
This commit is contained in:
parent
4b42a1d050
commit
93cdb07d8c
3 changed files with 18 additions and 18 deletions
|
@ -71,16 +71,18 @@ public abstract class RemoteLaunchTargetProvider implements ILaunchTargetProvide
|
|||
@Override
|
||||
public void connectionChanged(RemoteConnectionChangeEvent event) {
|
||||
IRemoteConnection connection = event.getConnection();
|
||||
switch (event.getType()) {
|
||||
case RemoteConnectionChangeEvent.CONNECTION_ADDED:
|
||||
targetManager.addLaunchTarget(getTypeId(), connection.getName());
|
||||
break;
|
||||
case RemoteConnectionChangeEvent.CONNECTION_REMOVED:
|
||||
ILaunchTarget target = targetManager.getLaunchTarget(getTypeId(), connection.getName());
|
||||
if (target != null) {
|
||||
targetManager.removeLaunchTarget(target);
|
||||
if (connection.getConnectionType().getId().equals(getTypeId())) {
|
||||
switch (event.getType()) {
|
||||
case RemoteConnectionChangeEvent.CONNECTION_ADDED:
|
||||
targetManager.addLaunchTarget(getTypeId(), connection.getName());
|
||||
break;
|
||||
case RemoteConnectionChangeEvent.CONNECTION_REMOVED:
|
||||
ILaunchTarget target = targetManager.getLaunchTarget(getTypeId(), connection.getName());
|
||||
if (target != null) {
|
||||
targetManager.removeLaunchTarget(target);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ public class LaunchActiveCommandHandler extends AbstractHandler {
|
|||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
try {
|
||||
LaunchBarManager launchBarManager = Activator.getDefault().getLaunchBarUIManager().getManager();
|
||||
StopActiveCommandHandler.stopActiveLaunches(launchBarManager);
|
||||
ILaunchConfiguration config = launchBarManager.getActiveLaunchConfiguration();
|
||||
if (config == null)
|
||||
return Status.OK_STATUS;
|
||||
|
|
|
@ -29,11 +29,6 @@ import org.eclipse.launchbar.ui.internal.Activator;
|
|||
import org.eclipse.launchbar.ui.internal.Messages;
|
||||
|
||||
public class StopActiveCommandHandler extends AbstractHandler {
|
||||
private LaunchBarManager launchBarManager;
|
||||
|
||||
public StopActiveCommandHandler() {
|
||||
launchBarManager = Activator.getDefault().getLaunchBarUIManager().getManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
|
@ -43,10 +38,10 @@ public class StopActiveCommandHandler extends AbstractHandler {
|
|||
|
||||
public void stop() {
|
||||
stopBuild();
|
||||
stopActiveLaunches();
|
||||
stopActiveLaunches(Activator.getDefault().getLaunchBarUIManager().getManager());
|
||||
}
|
||||
|
||||
protected void stopActiveLaunches() {
|
||||
static void stopActiveLaunches(LaunchBarManager launchBarManager) {
|
||||
final ILaunch[] activeLaunches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
|
||||
if (activeLaunches != null && activeLaunches.length > 0) {
|
||||
new Job(Messages.StopActiveCommandHandler_0) {
|
||||
|
@ -64,8 +59,10 @@ public class StopActiveCommandHandler extends AbstractHandler {
|
|||
continue;
|
||||
}
|
||||
if (launchConfig instanceof ILaunchConfigurationWorkingCopy) {
|
||||
// There are evil delegates that use a working copy for scratch storage
|
||||
if (activeConfig.equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) {
|
||||
// There are evil delegates that use a working
|
||||
// copy for scratch storage
|
||||
if (activeConfig
|
||||
.equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) {
|
||||
launch.terminate();
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue