[yocto] [PATCH 2/7] plugins/sdk.ide: Extracted launchers creation

Atanas Gegov atanas.gegov.oss at gmail.com
Mon Jun 3 01:29:52 PDT 2013


From: Atanas Gegov <atanas.gegov at bmw-carit.de>

The creation of the RemoteDebug launcher and the
Qemu launcher is extracted in an own method. The
creation of both launchers should be decoupled
from the setting of the project environment. This
is done in the next patch.
---
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |   44 ++++++++++++--------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
index 01b1288..76bac26 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
@@ -231,30 +231,38 @@ public class YoctoSDKUtils {
 
 		setEnvVars(cpdesc, elem, envMap);
 
+		createRemoteDebugAndQemuLaunchers(project, elem);
 		try {
-			ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
-			ILaunchConfigurationType configType =
-				lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
-			ILaunchConfigurationType debug_configType =
-				lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");
-
-			String sPath = envMap.get("PATH");
-			String sDebugName = envMap.get("GDB");
-			String sysroot_str = elem.getStrSysrootLoc();
-			if (configType == null || debug_configType == null)
-				throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
-			createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str);
-
-			ArrayList<String> listValue = new ArrayList<String>();
-			listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
-			if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
-				createQemuLauncher(project, configType, listValue, sFileName, elem);
-			}
 			CoreModel.getDefault().setProjectDescription(project,cpdesc);
 		} catch (CoreException e) {
 			e.printStackTrace();
 		}
 	}
+	
+	public static void createRemoteDebugAndQemuLaunchers(IProject project, YoctoUIElement elem) throws YoctoGeneralException {
+		ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
+		ILaunchConfigurationType configType =
+				lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
+		ILaunchConfigurationType debug_configType =
+				lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");
+
+		String sPath = getEnvValue(project, "PATH");
+		String sDebugName = getEnvValue(project, "GDB");
+		String sysroot_str = elem.getStrSysrootLoc();
+
+		if (configType == null || debug_configType == null) {
+			throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
+		}
+		createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str);
+
+		ArrayList<String> listValue = new ArrayList<String>();
+		listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
+
+		if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
+			String sFileName = getEnvironmentSetupFileFullPath(elem);
+			createQemuLauncher(project, configType, listValue, sFileName, elem);
+		}
+	}
 
 	protected static void createRemoteDebugLauncher(IProject project,
 			ILaunchManager lManager, ILaunchConfigurationType configType,
-- 
1.7.9.5




More information about the yocto mailing list