summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java')
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java461
1 files changed, 461 insertions, 0 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
new file mode 100644
index 0000000..2ac48f8
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
@@ -0,0 +1,461 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 * BMW Car IT - add methods to use different preference stores
11 * Atanas Gegov (BMW Car IT) - add method to get the project environment
12 *******************************************************************************/
13package org.yocto.sdk.ide.utils;
14
15import java.io.BufferedReader;
16import java.io.File;
17import java.io.FileReader;
18import java.io.FileWriter;
19import java.io.IOException;
20import java.util.ArrayList;
21import java.util.HashMap;
22import java.util.HashSet;
23import java.util.Iterator;
24import java.util.Set;
25import java.util.StringTokenizer;
26
27import org.eclipse.cdt.core.CCorePlugin;
28import org.eclipse.cdt.core.envvar.IContributedEnvironment;
29import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
30import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
31import org.eclipse.cdt.core.model.CoreModel;
32import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
33import org.eclipse.cdt.core.settings.model.ICProjectDescription;
34import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
35import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
36import org.eclipse.core.resources.IProject;
37import org.eclipse.core.runtime.CoreException;
38import org.eclipse.debug.core.DebugPlugin;
39import org.eclipse.debug.core.ILaunchConfiguration;
40import org.eclipse.debug.core.ILaunchConfigurationType;
41import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
42import org.eclipse.debug.core.ILaunchManager;
43import org.eclipse.jface.preference.IPreferenceStore;
44import org.yocto.sdk.ide.YoctoGeneralException;
45import org.yocto.sdk.ide.YoctoProfileElement;
46import org.yocto.sdk.ide.YoctoSDKPlugin;
47import org.yocto.sdk.ide.YoctoUIElement;
48import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature;
49import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
50import org.yocto.sdk.ide.preferences.PreferenceConstants;
51
52public class YoctoSDKUtils {
53
54 private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot=";
55 private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot=";
56
57 private static final String DEFAULT_USR_BIN = "/usr/bin/";
58 private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT";
59
60 public static String getEnvValue(IProject project, String strKey)
61 {
62 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
63 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
64 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
65 IContributedEnvironment env = manager.getContributedEnvironment();
66 IEnvironmentVariable var = env.getVariable(strKey, ccdesc);
67
68 if (var == null)
69 {
70 System.out.printf("ENV key %s is NULL\n", strKey);
71 return "";
72 }
73
74 else
75 return var.getValue();
76 }
77
78 /* Save project wide settings into ENV VARs including POKY preference settings
79 * and Environment Script File export VARs
80 */
81 private static void setEnvVars(ICProjectDescription cpdesc,
82 YoctoUIElement elem, HashMap<String, String> envMap) {
83 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
84 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
85 IContributedEnvironment env = manager.getContributedEnvironment();
86 String delimiter = manager.getDefaultDelimiter();
87
88 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE)
89 env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE,
90 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
91 else
92 env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE,
93 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
94
95 env.addVariable(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot(),
96 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
97 env.addVariable(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget(),
98 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
99 env.addVariable(PreferenceConstants.TARGET_ARCH_INDEX, String.valueOf(elem.getIntTargetIndex()),
100 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
101
102 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE)
103 env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE,
104 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
105 else
106 env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE,
107 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
108
109 env.addVariable(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc(),
110 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
111 env.addVariable(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption(),
112 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
113 env.addVariable(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc(),
114 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
115
116 if (envMap == null)
117 {
118 System.out.println("ENV var hasmap is NULL, Please check ENV script File!");
119 return;
120 }
121 Iterator<String> iter = envMap.keySet().iterator();
122 while (iter.hasNext())
123 {
124 String sKey = (String)iter.next();
125 String sValue = (String)envMap.get(sKey);
126 String targetFilePath;
127 File targetFile;
128 //replace --sysroot
129 if (sKey.matches("CFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("LDFLAGS") ||
130 sKey.matches("CPPFLAGS")) {
131
132 int SYSROOT_idx = sValue.lastIndexOf(DEFAULT_SYSROOT_PREFIX);
133 if (SYSROOT_idx >=0 )
134 sValue = sValue.substring(0, SYSROOT_idx) + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc();
135 else
136 sValue = " " + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc();
137 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
138 targetFile = new File(targetFilePath);
139 if (targetFile.exists())
140 sValue = sValue + "/" + elem.getStrTarget();
141 } else if (sKey.matches("CONFIGURE_FLAGS")) {
142 int LIBTOOL_idx = sValue.lastIndexOf(LIBTOOL_SYSROOT_PREFIX);
143 if (LIBTOOL_idx >= 0)
144 sValue = sValue.substring(0, LIBTOOL_idx) + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc();
145 else
146 sValue = " " + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc();
147 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
148 targetFile = new File(targetFilePath);
149 if (targetFile.exists())
150 sValue = sValue + "/" + elem.getStrTarget();
151 } else if(sKey.matches("PKG_CONFIG_SYSROOT_DIR") || sKey.matches("OECORE_TARGET_SYSROOT")) {
152 sValue = elem.getStrSysrootLoc();
153 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
154 targetFile = new File(targetFilePath);
155 if (targetFile.exists())
156 sValue = sValue + "/" + elem.getStrTarget();
157 } else if (sKey.matches("PKG_CONFIG_PATH")) {
158 sValue = elem.getStrSysrootLoc();
159 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
160 targetFile = new File(targetFilePath);
161 if (targetFile.exists())
162 sValue = sValue + "/" + elem.getStrTarget();
163 sValue = sValue + "/usr/lib/pkgconfig";
164 }
165 // env.addVariable(sKey, elem.getStrSysrootLoc(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
166 /*
167 else if (sKey.matches("PKG_CONFIG_PATH"))
168 env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget()+"/usr/lib/pkgconfig", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
169 //env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
170 else if (sKey.matches("PKG_CONFIG_SYSROOT_DIR"))
171 env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
172 */
173 env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
174 }
175 //add ACLOCAL OPTS for libtool 2.4 support
176 env.addVariable("OECORE_ACLOCAL_OPTS",
177 "-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal",
178 IEnvironmentVariable.ENVVAR_REPLACE,
179 delimiter,
180 ccdesc);
181 return;
182
183 }
184
185 private static String getEnvironmentSetupFileFullPath(YoctoUIElement elem) {
186 String envSetupFile = "";
187
188 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
189 envSetupFile = elem.getStrToolChainRoot() + "/";
190 } else {
191 //POKY TREE Mode
192 envSetupFile = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX;
193 }
194 envSetupFile += YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
195 return envSetupFile;
196 }
197
198 private static HashMap<String, String> parseEnvScript(String sFileName) {
199 try {
200 HashMap<String, String> envMap = new HashMap<String, String>();
201 File file = new File(sFileName);
202
203 if (file.exists()) {
204 BufferedReader input = new BufferedReader(new FileReader(file));
205
206 try {
207 String line = null;
208
209 while ((line = input.readLine()) != null) {
210 if (!line.startsWith("export")) {
211 continue;
212 }
213 String sKey = line.substring("export".length() + 1, line.indexOf('='));
214 String sValue = line.substring(line.indexOf('=') + 1);
215 if (sValue.startsWith("\"") && sValue.endsWith("\""))
216 sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"'));
217 /* If PATH ending with $PATH, we need to join with current system path */
218 if (sKey.equalsIgnoreCase("PATH")) {
219 if (sValue.lastIndexOf("$PATH") >= 0)
220 sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH");
221 }
222 envMap.put(sKey, sValue);
223 System.out.printf("get env key %s value %s\n", sKey, sValue);
224 }
225 } finally {
226 input.close();
227 }
228 }
229
230 return envMap;
231
232 } catch (IOException e) {
233 e.printStackTrace();
234 return null;
235 }
236 }
237
238 public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) {
239 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
240
241 String sFileName = getEnvironmentSetupFileFullPath(elem);
242 HashMap<String, String> envMap = parseEnvScript(sFileName);
243
244 setEnvVars(cpdesc, elem, envMap);
245 try {
246 CoreModel.getDefault().setProjectDescription(project,cpdesc);
247 } catch (CoreException e) {
248 e.printStackTrace();
249 }
250 }
251
252 public static void createRemoteDebugAndQemuLaunchers(IProject project, YoctoUIElement elem) throws YoctoGeneralException {
253 ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
254 ILaunchConfigurationType configType =
255 lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
256 ILaunchConfigurationType debug_configType =
257 lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");
258
259 String sPath = getEnvValue(project, "PATH");
260 String sDebugName = getEnvValue(project, "GDB");
261 String sysroot_str = elem.getStrSysrootLoc();
262
263 if (configType == null || debug_configType == null) {
264 throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
265 }
266 createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str);
267
268 ArrayList<String> listValue = new ArrayList<String>();
269 listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
270
271 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
272 String sFileName = getEnvironmentSetupFileFullPath(elem);
273 createQemuLauncher(project, configType, listValue, sFileName, elem);
274 }
275 }
276
277 protected static void createRemoteDebugLauncher(IProject project,
278 ILaunchManager lManager, ILaunchConfigurationType configType,
279 String sTargetTriplet, String strPath, String sDebugName, String sSysroot) {
280 try {
281
282 String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet;
283 StringTokenizer token = new StringTokenizer(strPath, ":");
284 String strDebugger = "";
285 while (token.hasMoreTokens())
286 {
287 String sTemp = token.nextToken();
288 if (sTemp.endsWith(sDebugSubDir)) {
289 strDebugger = sTemp + "/" + sDebugName;
290 break;
291 }
292 }
293 if (strDebugger.isEmpty())
294 return;
295 //If get default Debugger successfully, go ahead!
296
297 //create the gdbinit file
298 String sDebugInitFile = project.getLocation().toString() + "/.gdbinit";
299 FileWriter out = new FileWriter(new File(sDebugInitFile));
300 out.write("set sysroot " + sSysroot);
301 out.flush();
302 out.close();
303
304 //set the launch configuration
305 String projectName = project.getName();
306 String configName = projectName+"_gdb_"+sTargetTriplet;
307 int i;
308 ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType);
309 for(i=0; i<configs.length; i++)
310 { //delete the old configuration
311 ILaunchConfiguration config=configs[i];
312 if(config.getName().equals(configName)) {
313 config.delete();
314 break;
315 }
316 }
317 ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(project, configName);
318 Set<String> modes=new HashSet<String>();
319 modes.add("debug");
320 w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch");
321 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
322 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
323 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
324 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
325 //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
326 w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true);
327 w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
328 if (!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID)) {
329 String pathToCompiledBinary = "";
330 if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) {
331 pathToCompiledBinary = "Debug/";
332 } else {
333 pathToCompiledBinary = "src/";
334 }
335 pathToCompiledBinary += projectName;
336 w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, pathToCompiledBinary);
337 }
338
339 w_copy.doSave();
340 }
341 catch (CoreException e)
342 {
343 System.out.println(e.getMessage());
344 }
345 catch (IOException e)
346 {
347 System.out.println("Failed to generate debug init file!");
348 System.out.println(e.getMessage());
349 }
350 }
351
352 protected static void createQemuLauncher(IProject project,
353 ILaunchConfigurationType configType,
354 ArrayList<String> listValue, String sScriptFile,
355 YoctoUIElement elem) {
356 try {
357
358 ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "qemu_"+elem.getStrTarget());
359
360 w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
361 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");
362
363 String argument = "-e \"source " + sScriptFile + ";runqemu " + qemuTargetTranslate(elem.getStrTarget()) + " " +
364 elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " + elem.getStrQemuOption() + ";bash\"";
365
366 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
367 w_copy.doSave();
368 } catch (CoreException e) {
369 }
370
371 }
372
373 private static String qemuTargetTranslate(String strTargetArch) {
374 String qemu_target = "";
375 if (strTargetArch.indexOf("i586") != -1) {
376 qemu_target = "qemux86";
377 } else if (strTargetArch.indexOf("x86_64") != -1) {
378 qemu_target = "qemux86-64";
379 } else if (strTargetArch.indexOf("arm") != -1) {
380 qemu_target = "qemuarm";
381 } else if (strTargetArch.indexOf("mips") != -1) {
382 qemu_target = "qemumips";
383 } else if (strTargetArch.indexOf("ppc") != -1) {
384 qemu_target = "qemuppc";
385 }
386 return qemu_target;
387 }
388
389 /* Get IDE wide POKY Preference settings from a specific preference store */
390 public static YoctoUIElement getElemFromStore(IPreferenceStore store) {
391 YoctoUIElement elem = new YoctoUIElement();
392 if (store.getString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
393 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
394 else
395 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
396
397 elem.setStrToolChainRoot(store.getString(PreferenceConstants.TOOLCHAIN_ROOT));
398 elem.setStrTarget(store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET));
399 elem.setIntTargetIndex(store.getInt(PreferenceConstants.TARGET_ARCH_INDEX));
400 elem.setStrQemuKernelLoc(store.getString(PreferenceConstants.QEMU_KERNEL));
401 elem.setStrQemuOption(store.getString(PreferenceConstants.QEMU_OPTION));
402 elem.setStrSysrootLoc(store.getString(PreferenceConstants.SYSROOT));
403
404 if (store.getString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE))
405 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
406 else
407 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
408
409 return elem;
410 }
411
412 /* Get default POKY Preference settings from the default preference store */
413 public static YoctoUIElement getDefaultElemFromDefaultStore()
414 {
415 IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
416 YoctoUIElement elem = new YoctoUIElement();
417 if (store.getDefaultString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
418 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
419 else
420 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
421
422 elem.setStrToolChainRoot(store.getDefaultString(PreferenceConstants.TOOLCHAIN_ROOT));
423 elem.setStrTarget(store.getDefaultString(PreferenceConstants.TOOLCHAIN_TRIPLET));
424 elem.setIntTargetIndex(store.getDefaultInt(PreferenceConstants.TARGET_ARCH_INDEX));
425 elem.setStrQemuKernelLoc(store.getDefaultString(PreferenceConstants.QEMU_KERNEL));
426 elem.setStrQemuOption(store.getDefaultString(PreferenceConstants.QEMU_OPTION));
427 elem.setStrSysrootLoc(store.getDefaultString(PreferenceConstants.SYSROOT));
428
429 if (store.getDefaultString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE))
430 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
431 else
432 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
433
434 return elem;
435 }
436
437 /* Save profiles and selected profile to the default preference store */
438 public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) {
439 saveProfilesToStore(profileElement, YoctoSDKPlugin.getDefault().getPreferenceStore());
440 }
441
442 /* Save profiles and selected profile to a specific preference store */
443 private static void saveProfilesToStore(YoctoProfileElement profileElement, IPreferenceStore store) {
444 store.setValue(PreferenceConstants.PROFILES, profileElement.getProfilesAsString());
445 store.setValue(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile());
446 }
447
448 /* Get profiles and selected profile from the default preference store */
449 public static YoctoProfileElement getProfilesFromDefaultStore()
450 {
451 return getProfilesFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore());
452 }
453
454 /* Get profiles and selected profile from a specific preference store */
455 private static YoctoProfileElement getProfilesFromStore(IPreferenceStore store) {
456 String profiles = store.getString(PreferenceConstants.PROFILES);
457 String selectedProfile = store.getString(PreferenceConstants.SELECTED_PROFILE);
458
459 return new YoctoProfileElement(profiles, selectedProfile);
460 }
461}