Adjust to removal of special launch config delegate for remote.
authorDoug Schaefer <dschaefer@qnx.com>
Tue, 19 May 2015 17:34:59 +0000 (13:34 -0400)
committerDoug Schaefer <dschaefer@qnx.com>
Tue, 19 May 2015 18:26:26 +0000 (14:26 -0400)
Change-Id: I767ca01a8a233b2b6ab197991a696b4deef52b8c

toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java
toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java
toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties

index 36fc60f..be6883b 100644 (file)
@@ -16,6 +16,7 @@ public class Messages extends NLS {
        private static final String BUNDLE_NAME = "org.eclipse.cdt.arduino.core.internal.messages"; //$NON-NLS-1$
        public static String ArduinoLaunchConfigurationDelegate_0;
        public static String ArduinoLaunchConfigurationDelegate_1;
+       public static String ArduinoLaunchConfigurationDelegate_2;
        public static String ArduinoProjectGenerator_0;
 
        static {
index ade578c..81ab255 100644 (file)
@@ -38,16 +38,18 @@ import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.launchbar.core.launch.RemoteLaunchConfigurationDelegate;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.launchbar.core.PerTargetLaunchConfigProvider;
 import org.eclipse.remote.core.IRemoteConnection;
 
-public class ArduinoLaunchConfigurationDelegate extends RemoteLaunchConfigurationDelegate {
+public class ArduinoLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
 
        public static final String TYPE_ID = "org.eclipse.cdt.arduino.core.launchConfigurationType"; //$NON-NLS-1$
 
        @Override
-       public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IRemoteConnection target,
-                       IProgressMonitor monitor) throws CoreException {
+       public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+               IRemoteConnection target = PerTargetLaunchConfigProvider.getTarget(configuration);
+               
                // 1. make sure proper build config is set active
                IProject project = configuration.getMappedResources()[0].getProject();
                ICProjectDescription projDesc = CCorePlugin.getDefault().getProjectDescription(project);
@@ -75,12 +77,15 @@ public class ArduinoLaunchConfigurationDelegate extends RemoteLaunchConfiguratio
        }
 
        @Override
-       public void launch(final ILaunchConfiguration configuration, String mode, final IRemoteConnection target,
-                       final ILaunch launch, IProgressMonitor monitor) throws CoreException {
+       public void launch(final ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
                new Job(Messages.ArduinoLaunchConfigurationDelegate_0) {
                        protected IStatus run(IProgressMonitor monitor) {
                                try {
                                        ArduinoLaunchConsoleService consoleService = getConsoleService();
+                                       IRemoteConnection target = PerTargetLaunchConfigProvider.getTarget(configuration);
+                                       if (target == null) {
+                                               return new Status(IStatus.ERROR, Activator.getId(), Messages.ArduinoLaunchConfigurationDelegate_2);
+                                       }
 
                                        // The project
                                        IProject project = (IProject) configuration.getMappedResources()[0];
index 20b2cca..6cc688b 100644 (file)
@@ -10,4 +10,5 @@ ArduinoLaunchConfigurationDelegate_1=No active Arduino remote connection.
 #     QNX Software Systems - Initial API and implementation
 ################################################################################
 ArduinoLaunchConfigurationDelegate_0=Arduino Launch
+ArduinoLaunchConfigurationDelegate_2=Target has not been selected for Launch Configuration
 ArduinoProjectGenerator_0=Write Arduino project file