From: Atanas Gegov <atanas.ge...@bmw-carit.de>

Added an own method (copied code) in YoctoSDKChecker
that checks the validity of the globally selected
profile. This method will be used in the next patch
and will replace duplicated code.
---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git 
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java 
b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
index 74d97a0..92db72a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
@@ -19,6 +19,7 @@ import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
@@ -98,6 +99,18 @@ public class YoctoSDKChecker {
                }
        };
 
+       public static void checkIfGloballySelectedYoctoProfileIsValid() throws 
YoctoGeneralException {
+               YoctoProfileElement profileElement = 
YoctoSDKUtils.getProfilesFromDefaultStore();
+               IPreferenceStore selectedProfileStore = 
YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+               YoctoUIElement elem = 
YoctoSDKUtils.getElemFromStore(selectedProfileStore);
+
+               SDKCheckResults result = checkYoctoSDK(elem);
+               if (result != SDKCheckResults.SDK_PASS){
+                       String strErrorMsg =  getErrorMessage(result, 
SDKCheckRequestFrom.Wizard);
+                       throw new YoctoGeneralException(strErrorMsg);
+               }
+       }
+
        public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
                if (elem.getStrToolChainRoot().isEmpty())
                        return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
-- 
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to