1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 13:35:22 +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:
Doug Schaefer 2016-02-27 20:15:07 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 4b42a1d050
commit 93cdb07d8c
3 changed files with 18 additions and 18 deletions

View file

@ -71,6 +71,7 @@ public abstract class RemoteLaunchTargetProvider implements ILaunchTargetProvide
@Override
public void connectionChanged(RemoteConnectionChangeEvent event) {
IRemoteConnection connection = event.getConnection();
if (connection.getConnectionType().getId().equals(getTypeId())) {
switch (event.getType()) {
case RemoteConnectionChangeEvent.CONNECTION_ADDED:
targetManager.addLaunchTarget(getTypeId(), connection.getName());
@ -83,5 +84,6 @@ public abstract class RemoteLaunchTargetProvider implements ILaunchTargetProvide
break;
}
}
}
}

View file

@ -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;

View file

@ -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;
}