All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors
@ 2013-02-27 14:37 Timo Mueller
  2013-02-27 14:37 ` [PATCH 1/5] plugins/sdk.ide: Move SDK check functionality to separate class Timo Mueller
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

Hi,

I tried to display the messages resulting from validating the
YoctoUISettings in the message area of the properties/preference pages
instead of showing a dialog. This led to some refactoring of the
validation functionality and also the messages.

If for example the user entered a SDK toolchain directory that doesn't
exist in the global preferences a dialog will show up showing the
error and telling him how he can do "IDE-wide settings". As he is
currently trying to do "IDE-wide settings" this advice is not really
necessary and the dialog can be really annoying.

I split up the messages into a one line error message and an
advice. This message can be shown in the page's message area instead
of opening a dialog with every configuration error. The advice can
still be used when we want to show a dialog to help the user,
e.g. when creating a new project.

On a side note I reactivated the YoctoSDKChecker class and moved all
the validation code from the utils, getting rid of some duplicated and
inconsistent code.

Best regards,
Timo

PS: This patch set is based on "plugins/sdk.ide: Remove profile edit
buttons from property page"

Timo Mueller (5):
  plugins/sdk.ide: Move SDK check functionality to separate class
  plugins/sdk.ide: Refactored the construction of mesages with
    SDKCheckResults
  plugins/sdk.ide: Show SDK check errors in message area
  plugins/sdk.ide: Removed validation from setCurrentInput
  plugins/sdk.ide: Use standard error dialog to show SDK check errors

 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     | 372 +++++++++++----------
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  42 ++-
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |   9 +-
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       | 255 --------------
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |  47 +--
 .../ide/preferences/YoctoSDKPreferencePage.java    |  84 +++--
 .../preferences/YoctoSDKProjectPropertyPage.java   |  87 +++--
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |  18 +-
 8 files changed, 344 insertions(+), 570 deletions(-)

-- 
1.7.11.7



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] plugins/sdk.ide: Move SDK check functionality to separate class
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
@ 2013-02-27 14:37 ` Timo Mueller
  2013-02-27 14:37 ` [PATCH 2/5] plugins/sdk.ide: Refactored the construction of mesages with SDKCheckResults Timo Mueller
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

The class YoctoSDKChecker provided some unused code for checking a
Yocto SDK configuration. Checking of the SDK was done in
YoctoSDKUtils. An enum for results was provided in both classes (under
the same name) but contained different possible values.

To avoid confusion, reduce duplicate code and to separate the checking
functionality from the rest of the utility functions, the checking
code has been moved completely to the YoctoSDKChecker.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     | 361 ++++++++++++---------
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |   9 +-
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       | 255 ---------------
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   8 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    |   2 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   |   2 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |  18 +-
 7 files changed, 229 insertions(+), 426 deletions(-)

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 87547a2..fd50f18 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
@@ -10,197 +10,252 @@
  *******************************************************************************/
 package org.yocto.sdk.ide;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
+import java.io.FilenameFilter;
+import java.io.IOException;
 
 public class YoctoSDKChecker {
+
 	public static enum SDKCheckResults {
 		SDK_PASS,
+		POKY_DEVICE_EMPTY,
 		TOOLCHAIN_LOCATION_EMPTY,
-		TOOLCHAIN_LOCATION_NON_EXIST,
-		TARGET_EMPTY,
+		TOOLCHAIN_LOCATION_NONEXIST,
+		SDK_TARGET_EMPTY,
 		QEMU_KERNEL_EMPTY,
-		//QEMU_ROOTFS_EMPTY,
-		SDK_BIN_NON_EXIST,
-		SDK_SYSROOT_NON_EXIST,
-		SDK_PKGCONFIG_NON_EXIST,
-		QEMU_KERNEL_NON_EXIST,
-		SYSROOT_NON_EXIST,
 		SYSROOT_EMPTY,
-		ENV_SETUP_SCRIPT_NON_EXIST
+		QEMU_KERNEL_NONEXIST,
+		SYSROOT_NONEXIST,
+		WRONG_ADT_VERSION,
+		ENV_SETUP_SCRIPT_NONEXIST,
+		TOOLCHAIN_NO_SYSROOT,
+		TOOLCHAIN_HOST_MISMATCH
 	};
 
 	public static enum SDKCheckRequestFrom {
 		Wizard,
 		Menu,
-		Preferences
+		Preferences,
+		Other
 	};
 
-	private static final String WIZARD_SDK_LOCATION_EMPTY     		= "Wizard.SDK.Location.Empty";
-	private static final String WIZARD_TOOLCHAIN_LOCATION_NONEXIST	= "Wizard.Toolcahin.Location.Nonexist";
-	private static final String WIZARD_SDK_TARGET_EMPTY      		= "Wizard.SDK.Target.Empty";
-	private static final String WIZARD_SDK_BIN_NONEXIST				= "Wizard.SDK.Bin.Nonexist";
-	private static final String WIZARD_SDK_SYSROOT_NONEXIST			= "Wizard.SDK.Sysroot.Nonexist";
-	private static final String WIZARD_SDK_PKGCONFIG_NONEXIST		= "Wizard.SDK.Pkgconfig.Nonexist";
-	private static final String WIZARD_QEMU_KERNEL_EMPTY			= "Wizard.Qemu.Kernel.Empty";
-	private static final String WIZARD_SYSROOT_EMPTY				= "Wizard.Sysroot.Empty";
-	private static final String WIZARD_QEMU_KERNEL_NONEXIST			= "Wizard.Qemu.Kernel.Nonexist";
-	private static final String WIZARD_SYSROOT_NONEXIST				= "Wizard.Sysroot.Nonexist";
-
-	private static final String MENU_SDK_LOCATION_EMPTY     		= "Menu.SDK.Location.Empty";
-	private static final String MENU_TOOLCHAIN_LOCATION_NONEXIST	= "Menu.Toolchain.Location.Nonexist";
-	private static final String MENU_SDK_TARGET_EMPTY      			= "Menu.SDK.Target.Empty";
-	private static final String MENU_SDK_BIN_NONEXIST       		= "Menu.SDK.Bin.Nonexist";
-	private static final String MENU_SDK_SYSROOT_NONEXIST   		= "Menu.SDK.Sysroot.Nonexist";
-	private static final String MENU_SDK_PKGCONFIG_NONEXIST 		= "Menu.SDK.Pkgconfig.Nonexist";
-	private static final String MENU_QEMU_KERNEL_EMPTY 				= "Menu.Qemu.Kernel.Empty";
-	private static final String MENU_SYSROOT_EMPTY 					= "Menu.Sysroot.Empty";
-	private static final String MENU_QEMU_KERNEL_NONEXIST 			= "Menu.Qemu.Kernel.Nonexist";
-	private static final String MENU_SYSROOT_NONEXIST 				= "Menu.Sysroot.Nonexist";
-
-	private static final String PREFERENCES_SDK_BIN_NONEXIST       = "Preferences.SDK.Bin.Nonexist";
-	private static final String PREFERENCES_SDK_SYSROOT_NONEXIST   = "Preferences.SDK.Sysroot.Nonexist";
-	private static final String PREFERENCES_SDK_PKGCONFIG_NONEXIST = "Preferences.SDK.Pkgconfig.Nonexist";
-	
-	private static final String ENV_SCRIPT_NONEXIST = "Env.Script.Nonexist";
+	private static final String POKY_DEVICE_EMPTY = "Poky.SDK.Device.Empty";
+	private static final String TOOLCHAIN_LOCATION_EMPTY     = "Poky.SDK.Location.Empty";
+	private static final String SDK_TARGET_EMPTY      = "Poky.SDK.Target.Empty";
+	private static final String TOOLCHAIN_LOCATION_NONEXIST = "Poky.SDK.Location.Nonexist";
+	private static final String QEMU_KERNEL_EMPTY 	  = "Poky.Qemu.Kernel.Empty";
+	private static final String SYSROOT_EMPTY = "Poky.Sysroot.Empty";
+	private static final String QEMU_KERNEL_NONEXIST = "Poky.Qemu.Kernel.Nonexist";
+	private static final String SYSROOT_NONEXIST = "Poky.Sysroot.Nonexist";
+	private static final String WRONG_ADT_VERSION = "Poky.ADT.Sysroot.Wrongversion";
+	private static final String ENV_SETUP_SCRIPT_NONEXIST = "Poky.Env.Script.Nonexist";
+	private static final String TOOLCHAIN_NO_SYSROOT = "Poky.Toolchain.No.Sysroot";
+	private static final String TOOLCHAIN_HOST_MISMATCH = "Poky.Toolchain.Host.Mismatch";
+	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
 	
-	private static final String PREFERENCES_TOOLCHAIN_LOCATION_NONEXIST = "Preferences.Toolchain.Location.Nonexist";
-	private static final String PREFERENCES_QEMU_KERNEL_EMPTY 			= "Preferences.Qemu.Kernel.Empty";
-	private static final String PREFERENCES_SYSROOT_EMPTY 				= "Preferences.Sysroot.Empty";
-	private static final String PREFERENCES_QEMU_KERNEL_NONEXIST   		= "Preferences.Qemu.Kernel.Nonexist";
-	private static final String PREFERENCES_SYSROOT_NONEXIST   			= "Preferences.Sysroot.Nonexist";
-
-	public static SDKCheckResults checkYoctoSDK(String sdkroot, String toolchain_location, String target, String target_qemu,
-			String qemu_kernel, String sysroot, String ip_addr) {
-	
-		if (toolchain_location.isEmpty()) {
-			return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;			
-		} else {
-			File toolchain = new File(toolchain_location);
-			if (!toolchain.exists())
-				return SDKCheckResults.TOOLCHAIN_LOCATION_NON_EXIST;
+	private static final String SYSROOTS_DIR = "sysroots";
+
+	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
+		if (elem.getStrToolChainRoot().isEmpty())
+			return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
+		else {
+			File fToolChain = new File(elem.getStrToolChainRoot());
+			if (!fToolChain.exists())
+				return SDKCheckResults.TOOLCHAIN_LOCATION_NONEXIST;
 		}
-		
-		if (sysroot.isEmpty()) 
+
+		if (elem.getStrSysrootLoc().isEmpty()) {
 			return SDKCheckResults.SYSROOT_EMPTY;
-		else {
-			File sysroot_dir = new File(sysroot);
+		} else {
+			File fSysroot = new File(elem.getStrSysrootLoc());
+			if (!fSysroot.exists())
+				return SDKCheckResults.SYSROOT_NONEXIST;
+		}
+
+		if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
+			//Check for SDK compatible with the host arch
+			String platform = YoctoSDKUtils.getPlatformArch();
+			String sysroot_dir_str = elem.getStrToolChainRoot() + "/" + SYSROOTS_DIR;
+			File sysroot_dir = new File(sysroot_dir_str);
 			if (!sysroot_dir.exists())
-				return SDKCheckResults.SYSROOT_NON_EXIST;
+				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+
+			String toolchain_host_arch = null;
+
+			try {
+				toolchain_host_arch = findHostArch(sysroot_dir);
+			} catch(NullPointerException e) {
+				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+			}
+
+			if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
+				if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
+					return SDKCheckResults.TOOLCHAIN_HOST_MISMATCH;
+			}
 		}
-	
-		if (target.isEmpty() || target==null) {
-			return SDKCheckResults.TARGET_EMPTY;
+
+		if (elem.getIntTargetIndex() < 0 || elem.getStrTarget().isEmpty()) {
+			//if this is poky tree mode, prompt user whether bitbake meta-ide-support is executed?
+			if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE)
+				return SDKCheckResults.ENV_SETUP_SCRIPT_NONEXIST;
+			else
+				return SDKCheckResults.SDK_TARGET_EMPTY;
+		} else {
+			String sFileName;
+
+			if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
+				sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();
+			} else {
+				//POKY TREE Mode
+				sFileName = elem.getStrToolChainRoot() + YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
+			}
+
+			try {
+				File file = new File(sFileName);
+				boolean bVersion = false;
+
+				if (file.exists()) {
+					BufferedReader input = new BufferedReader(new FileReader(file));
+
+					try {
+						String line = null;
+
+						while ((line = input.readLine()) != null) {
+							if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION)) {
+								int beginIndex = 2;
+								String sVersion = "";
+								for (;;) {
+									char cValue = line.charAt(line.indexOf('=') + beginIndex++);
+
+									if ((cValue != '.') && (!Character.isDigit(cValue)) && (cValue != '+'))
+										break;
+									else
+										sVersion += String.valueOf(cValue);
+								}
+
+								for (int i = 0; i < saInvalidVer.length; i++) {
+									if (!sVersion.equals(saInvalidVer[i])) {
+										bVersion = true;
+										break;
+									}
+								}
+
+								break;
+							}
+						}
+					} finally {
+						input.close();
+					}
+
+					if (!bVersion)
+						return SDKCheckResults.WRONG_ADT_VERSION;
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
 		}
-		
-		if (target_qemu.equals("true")) {
-			if (qemu_kernel.isEmpty())
+
+		if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
+			if (elem.getStrQemuKernelLoc().isEmpty()) {
 				return SDKCheckResults.QEMU_KERNEL_EMPTY;
-			else {
-				File kernel_file = new File(qemu_kernel);
-				if (!kernel_file.exists())
-					return SDKCheckResults.QEMU_KERNEL_NON_EXIST;
+			} else {
+				File fQemuKernel = new File(elem.getStrQemuKernelLoc());
+				if (!fQemuKernel.exists())
+					return SDKCheckResults.QEMU_KERNEL_NONEXIST;
 			}
-		
 		}
-		
+
 		return SDKCheckResults.SDK_PASS;
 	}
 
-	private static String getWizardErrorMessage(SDKCheckResults result) {
-		switch (result) {
-		case TOOLCHAIN_LOCATION_EMPTY:
-			return  YoctoSDKMessages.getString(WIZARD_SDK_LOCATION_EMPTY);
-		case TOOLCHAIN_LOCATION_NON_EXIST:
-			return YoctoSDKMessages.getString(WIZARD_TOOLCHAIN_LOCATION_NONEXIST);
-		case TARGET_EMPTY:
-			return  YoctoSDKMessages.getString(WIZARD_SDK_TARGET_EMPTY);
-		case QEMU_KERNEL_EMPTY:
-			return YoctoSDKMessages.getString(WIZARD_QEMU_KERNEL_EMPTY);
-		case SYSROOT_EMPTY:
-			return YoctoSDKMessages.getString(WIZARD_SYSROOT_EMPTY);
-		case QEMU_KERNEL_NON_EXIST:
-			return YoctoSDKMessages.getString(WIZARD_QEMU_KERNEL_NONEXIST);
-		case SYSROOT_NON_EXIST:
-			return YoctoSDKMessages.getString(WIZARD_SYSROOT_NONEXIST);
-		case SDK_BIN_NON_EXIST:
-			return  YoctoSDKMessages.getString(WIZARD_SDK_BIN_NONEXIST);
-		case SDK_SYSROOT_NON_EXIST:
-			return  YoctoSDKMessages.getString(WIZARD_SDK_SYSROOT_NONEXIST);
-		case SDK_PKGCONFIG_NON_EXIST:
-			return  YoctoSDKMessages.getString(WIZARD_SDK_PKGCONFIG_NONEXIST);
-		default:
-			return null;
-		}
-	}
+	public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) {
+		String strErrorMsg;
 
-	private static String getMenuErrorMessage(SDKCheckResults result) {
-		switch (result) {
-		case TOOLCHAIN_LOCATION_EMPTY:
-			return  YoctoSDKMessages.getString(MENU_SDK_LOCATION_EMPTY);
-		case TOOLCHAIN_LOCATION_NON_EXIST:
-			return YoctoSDKMessages.getString(MENU_TOOLCHAIN_LOCATION_NONEXIST);
-		case TARGET_EMPTY:
-			return  YoctoSDKMessages.getString(MENU_SDK_TARGET_EMPTY);
-		case QEMU_KERNEL_EMPTY:
-			return YoctoSDKMessages.getString(MENU_QEMU_KERNEL_EMPTY);
-		//case QEMU_ROOTFS_EMPTY:
-		//	return YoctoSDKMessages.getString(MENU_QEMU_ROOTFS_EMPTY);
-		case QEMU_KERNEL_NON_EXIST:
-			return YoctoSDKMessages.getString(MENU_QEMU_KERNEL_NONEXIST);
-		case SYSROOT_NON_EXIST:
-			return YoctoSDKMessages.getString(MENU_SYSROOT_NONEXIST);
-		case SYSROOT_EMPTY:
-			return YoctoSDKMessages.getString(MENU_SYSROOT_EMPTY);
-		case SDK_BIN_NON_EXIST:
-			return  YoctoSDKMessages.getString(MENU_SDK_BIN_NONEXIST);
-		case SDK_SYSROOT_NON_EXIST:
-			return  YoctoSDKMessages.getString(MENU_SDK_SYSROOT_NONEXIST);
-		case SDK_PKGCONFIG_NON_EXIST:
-			return  YoctoSDKMessages.getString(MENU_SDK_PKGCONFIG_NONEXIST);
+		switch (from) {
+		case Wizard:
+			strErrorMsg = "Yocto Wizard Configuration Error:";
+			break;
+		case Menu:
+			strErrorMsg = "Yocto Menu Configuration Error!";
+			break;
+		case Preferences:
+			strErrorMsg = "Yocto Preferences Configuration Error!";
+			break;
 		default:
-			return null;
+			strErrorMsg = "Yocto Configuration Error!";
+			break;
 		}
-	}
 
-	private static String getPreferencesErrorMessage(SDKCheckResults result) {
 		switch (result) {
+		case POKY_DEVICE_EMPTY:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(POKY_DEVICE_EMPTY);
+			break;
 		case TOOLCHAIN_LOCATION_EMPTY:
-			return  YoctoSDKMessages.getString(MENU_SDK_LOCATION_EMPTY);
-		case TOOLCHAIN_LOCATION_NON_EXIST:
-			return YoctoSDKMessages.getString(PREFERENCES_TOOLCHAIN_LOCATION_NONEXIST);
-		case TARGET_EMPTY:
-			return  YoctoSDKMessages.getString(MENU_SDK_TARGET_EMPTY);
-		case SDK_BIN_NON_EXIST:
-			return  YoctoSDKMessages.getString(PREFERENCES_SDK_BIN_NONEXIST); 
-		case SDK_SYSROOT_NON_EXIST:
-			return  YoctoSDKMessages.getString(PREFERENCES_SDK_SYSROOT_NONEXIST);
-		case SDK_PKGCONFIG_NON_EXIST:
-			return  YoctoSDKMessages.getString(PREFERENCES_SDK_PKGCONFIG_NONEXIST);	
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_EMPTY);
+			break;
+		case SDK_TARGET_EMPTY:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SDK_TARGET_EMPTY);
+			break;
+		case TOOLCHAIN_LOCATION_NONEXIST:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_NONEXIST);
+			break;
 		case QEMU_KERNEL_EMPTY:
-			return YoctoSDKMessages.getString(PREFERENCES_QEMU_KERNEL_EMPTY);
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_EMPTY);
+			break;
 		case SYSROOT_EMPTY:
-			return YoctoSDKMessages.getString(PREFERENCES_SYSROOT_EMPTY);
-		case QEMU_KERNEL_NON_EXIST:
-			return YoctoSDKMessages.getString(PREFERENCES_QEMU_KERNEL_NONEXIST);
-		case SYSROOT_NON_EXIST:
-			return YoctoSDKMessages.getString(PREFERENCES_SYSROOT_NONEXIST);
-		case ENV_SETUP_SCRIPT_NON_EXIST:
-			return YoctoSDKMessages.getString(ENV_SCRIPT_NONEXIST);
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_EMPTY);
+			break;
+		case QEMU_KERNEL_NONEXIST:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_NONEXIST);
+			break;
+		case SYSROOT_NONEXIST:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_NONEXIST);
+			break;
+		case WRONG_ADT_VERSION:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(WRONG_ADT_VERSION);
+			break;
+		case ENV_SETUP_SCRIPT_NONEXIST:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(ENV_SETUP_SCRIPT_NONEXIST);
+			break;
+		case TOOLCHAIN_NO_SYSROOT:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_NO_SYSROOT);
+			break;
+		case TOOLCHAIN_HOST_MISMATCH:
+			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_HOST_MISMATCH);
+			break;
 		default:
-			return null;
+			break;
 		}
+
+		return strErrorMsg;
 	}
 
-	public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) {
-		switch (from) {
-			case Wizard:
-				return getWizardErrorMessage(result);
-			case Menu:
-				return getMenuErrorMessage(result);
-			case Preferences:
-				return getPreferencesErrorMessage(result);
-			default:
-				return null;
+	private static String findHostArch(File sysroot_dir) {
+		FilenameFilter nativeFilter = new FilenameFilter() {
+			public boolean accept(File dir, String name) {
+				if (name.endsWith("sdk-linux")) {
+					return true;
+				} else {
+					return false;
+				}
+			}
+		};
+
+		File[] files = sysroot_dir.listFiles(nativeFilter);
+		String arch = null;
+
+		for (File file : files) {
+			if (file.isDirectory()) {
+				String path = file.getName();
+				String[] subPath = path.split("-");
+				arch = subPath[0];
+			} else {
+				continue;
+			}
 		}
-	}	
+
+		return arch;
+	}
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
index b0e7121..69b1e2a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
@@ -38,7 +38,8 @@ import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.jface.preference.IPreferenceStore;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 
 
 @SuppressWarnings("restriction")
@@ -157,9 +158,9 @@ public class YoctoSDKProjectNature implements IProjectNature {
 		YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
 		IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
 		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-		YoctoSDKUtils.SDKCheckResults result = YoctoSDKUtils.checkYoctoSDK(elem);
-		if (result != YoctoSDKUtils.SDKCheckResults.SDK_PASS){		
-			String strErrorMsg =  YoctoSDKUtils.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
+		SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
+		if (result != SDKCheckResults.SDK_PASS){
+			String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
 			throw new YoctoGeneralException(strErrorMsg);
 		}
 		else
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 11d68e0..4a10d8d 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -14,7 +14,6 @@ package org.yocto.sdk.ide;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -43,240 +42,11 @@ import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
 
-	public static enum SDKCheckResults {
-		SDK_PASS,
-		POKY_DEVICE_EMPTY,
-		TOOLCHAIN_LOCATION_EMPTY,
-		TOOLCHAIN_LOCATION_NONEXIST,
-		SDK_TARGET_EMPTY,
-		QEMU_KERNEL_EMPTY,
-		SYSROOT_EMPTY,
-		QEMU_KERNEL_NONEXIST,
-		SYSROOT_NONEXIST,
-		WRONG_ADT_VERSION,
-		ENV_SETUP_SCRIPT_NONEXIST,
-		TOOLCHAIN_NO_SYSROOT,
-		TOOLCHAIN_HOST_MISMATCH
-	};
-
-	public static enum SDKCheckRequestFrom {
-		Wizard,
-		Menu,
-		Preferences,
-		Other
-	};
-
 	private static final String PROJECT_SCOPE = "org.yocto.sdk.ide";
-	private static final String POKY_DEVICE_EMPTY = "Poky.SDK.Device.Empty";
-	private static final String TOOLCHAIN_LOCATION_EMPTY     = "Poky.SDK.Location.Empty";
-	private static final String SDK_TARGET_EMPTY      = "Poky.SDK.Target.Empty";
-	private static final String TOOLCHAIN_LOCATION_NONEXIST = "Poky.SDK.Location.Nonexist";
-	private static final String QEMU_KERNEL_EMPTY 	  = "Poky.Qemu.Kernel.Empty";
-	private static final String SYSROOT_EMPTY = "Poky.Sysroot.Empty";
-	private static final String QEMU_KERNEL_NONEXIST = "Poky.Qemu.Kernel.Nonexist";
-	private static final String SYSROOT_NONEXIST = "Poky.Sysroot.Nonexist";
-	private static final String WRONG_ADT_VERSION = "Poky.ADT.Sysroot.Wrongversion";
-	private static final String ENV_SETUP_SCRIPT_NONEXIST = "Poky.Env.Script.Nonexist";
-	private static final String TOOLCHAIN_NO_SYSROOT = "Poky.Toolchain.No.Sysroot";
-	private static final String TOOLCHAIN_HOST_MISMATCH = "Poky.Toolchain.Host.Mismatch";
-	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
 	private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot=";
 	private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot=";
-	private static final String SYSROOTS_DIR = "sysroots";
 	private static final String CONSOLE_MESSAGE  = "Menu.SDK.Console.Configure.Message";
 
-	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {		
-		
-		if (elem.getStrToolChainRoot().isEmpty())
-			return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
-		else {
-			File fToolChain = new File(elem.getStrToolChainRoot());
-			if (!fToolChain.exists())
-				return SDKCheckResults.TOOLCHAIN_LOCATION_NONEXIST;
-		}
-
-		if (elem.getStrSysrootLoc().isEmpty())
-			return SDKCheckResults.SYSROOT_EMPTY;
-		else {
-			File fSysroot = new File(elem.getStrSysrootLoc());
-			if (!fSysroot.exists())
-				return SDKCheckResults.SYSROOT_NONEXIST;
-		}
-		if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
-			//Check for SDK compatible with the host arch
-			String platform = getPlatformArch();
-			String sysroot_dir_str = elem.getStrToolChainRoot() + "/" + SYSROOTS_DIR;
-			File sysroot_dir = new File(sysroot_dir_str);
-			if (!sysroot_dir.exists())
-				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-			
-			String toolchain_host_arch = null;
-			
-			try 
-			{
-				toolchain_host_arch = findHostArch(sysroot_dir);
-			}
-			catch(NullPointerException e) 
-			{
-				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-			}
-			
-			if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
-				if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
-					return SDKCheckResults.TOOLCHAIN_HOST_MISMATCH;
-			}
-		}
-		if (elem.getIntTargetIndex() < 0 || elem.getStrTarget().isEmpty())
-		{
-			//if this is poky tree mode, prompt user whether bitbake meta-ide-support is executed?
-			if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE)
-				return SDKCheckResults.ENV_SETUP_SCRIPT_NONEXIST;
-			else
-				return SDKCheckResults.SDK_TARGET_EMPTY;
-		}
-		else
-		{
-			String sFileName;
-			if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
-				sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();
-			}
-			else {
-				//POKY TREE Mode
-				sFileName = elem.getStrToolChainRoot() + YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
-			}
-			try
-			{
-
-				File file = new File(sFileName);
-				boolean bVersion = false;
-
-				if (file.exists()) {
-					BufferedReader input = new BufferedReader(new FileReader(file));
-
-					try
-					{
-						String line = null;
-
-						while ((line = input.readLine()) != null)
-						{							
-							if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION))
-							{
-								int beginIndex = 2;
-								String sVersion = "";
-								for (;;) 
-								{
-									char cValue = line.charAt(line.indexOf('=') + beginIndex++);
-									if ((cValue != '.') && (!Character.isDigit(cValue)) && (cValue != '+'))
-										break;
-									else
-										sVersion += String.valueOf(cValue);
-								}
-								for (int i = 0; i < saInvalidVer.length; i++)
-								{
-									if (!sVersion.equals(saInvalidVer[i]))
-									{
-										bVersion = true;
-										break;
-									}
-										
-								}
-								break;
-							}
-						}
-
-					}
-					finally {
-						input.close();
-					}
-					if (!bVersion)
-						return SDKCheckResults.WRONG_ADT_VERSION;
-
-				}
-			}
-			catch (IOException e)
-			{
-				e.printStackTrace();
-
-			}
-		}
-
-		if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE)
-		{
-			if (elem.getStrQemuKernelLoc().isEmpty())
-				return SDKCheckResults.QEMU_KERNEL_EMPTY;
-			else {
-				File fQemuKernel = new File(elem.getStrQemuKernelLoc());
-				if (!fQemuKernel.exists())
-					return SDKCheckResults.QEMU_KERNEL_NONEXIST;
-			}
-		}
-
-		return SDKCheckResults.SDK_PASS;
-	}
-
-
-
-	public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) {
-		String strErrorMsg;
-		switch (from) {
-		case Wizard:
-			strErrorMsg = "Yocto Wizard Configuration Error:";
-			break;
-		case Menu:
-			strErrorMsg = "Yocto Menu Configuration Error!";
-			break;
-		case Preferences:
-			strErrorMsg = "Yocto Preferences Configuration Error!";
-			break;
-		default:
-			strErrorMsg = "Yocto Configuration Error!";
-			break;
-		}
-
-		switch (result) {
-		case POKY_DEVICE_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(POKY_DEVICE_EMPTY);
-			break;
-		case TOOLCHAIN_LOCATION_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_EMPTY);
-			break;
-		case SDK_TARGET_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SDK_TARGET_EMPTY);
-			break;
-		case TOOLCHAIN_LOCATION_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_NONEXIST);
-			break;
-		case QEMU_KERNEL_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_EMPTY);
-			break;
-		case SYSROOT_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_EMPTY);
-			break;
-		case QEMU_KERNEL_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_NONEXIST);
-			break;
-		case SYSROOT_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_NONEXIST);
-			break;
-		case WRONG_ADT_VERSION:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(WRONG_ADT_VERSION);
-			break;
-		case ENV_SETUP_SCRIPT_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(ENV_SETUP_SCRIPT_NONEXIST);
-			break;
-		case TOOLCHAIN_NO_SYSROOT:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_NO_SYSROOT);
-			break;
-		case TOOLCHAIN_HOST_MISMATCH:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_HOST_MISMATCH);
-			break;
-		default:
-			break;
-		}
-		return strErrorMsg;
-	}
-
-
 	public static String getEnvValue(IProject project, String strKey)
 	{
 		ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
@@ -731,31 +501,6 @@ public class YoctoSDKUtils {
           }
 		return value;
 	}
-	
-	static private String findHostArch(File sysroot_dir) {
-		FilenameFilter nativeFilter = new FilenameFilter() {
-			public boolean accept(File dir, String name) {
-				if (name.endsWith("sdk-linux")) {
-					return true;
-				} else {
-					return false;
-				}
-			}
-		};
-
-		File copyFile = null;
-		File[] files = sysroot_dir.listFiles(nativeFilter);
-		String arch = null;
-		for (File file : files) {
-			if (file.isDirectory()) {
-				String path = file.getName();
-				String[] subPath = path.split("-");
-				arch = subPath[0];
-			} else 
-				continue;
-        }
-		return arch;
-	}
 
 	/* Save profiles and selected profile to the default preference store */
 	public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) {
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index f7e7a3a..74cfd69 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -36,8 +36,8 @@ import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.swt.widgets.Widget;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckResults;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoUISetting {
@@ -349,11 +349,11 @@ public class YoctoUISetting {
 		boolean pass = true;
 		String strErrorMessage;
 
-		SDKCheckResults result = YoctoSDKUtils.checkYoctoSDK(elem);
+		SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
 
 		//Show Error Message on the Label to help users.
 		if (result != SDKCheckResults.SDK_PASS) {
-			strErrorMessage = YoctoSDKUtils.getErrorMessage(result, from);
+			strErrorMessage = YoctoSDKChecker.getErrorMessage(result, from);
 			pass = false;
 			if (bPrompt)
 			{
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index 3e0fa54..ef681a4 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -33,7 +33,7 @@ import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKUtils;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
index 7f0d25e..551d3bd 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
@@ -24,9 +24,9 @@ import org.yocto.sdk.ide.YoctoGeneralException;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKUtils;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
index 7c02f87..f332a9a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
@@ -10,15 +10,17 @@
  *******************************************************************************/
 package org.yocto.sdk.ide.wizard;
 
-import java.util.List;
 import java.util.LinkedHashMap;
+import java.util.List;
 
+import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
 import org.eclipse.cdt.core.CCorePlugin;
 import org.eclipse.cdt.core.templateengine.TemplateCore;
 import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
 import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
 import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
 import org.eclipse.cdt.core.templateengine.process.processes.Messages;
+import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
 import org.eclipse.cdt.make.core.MakeCorePlugin;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
@@ -36,19 +38,19 @@ import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
-import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.YoctoGeneralException;
 import org.yocto.sdk.ide.YoctoProfileElement;
+import org.yocto.sdk.ide.YoctoSDKChecker;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
-import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
 
 
 @SuppressWarnings("restriction")
@@ -120,9 +122,9 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 				YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
 				IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
 				YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-				YoctoSDKUtils.SDKCheckResults result = YoctoSDKUtils.checkYoctoSDK(elem);
-				if (result != YoctoSDKUtils.SDKCheckResults.SDK_PASS){		
-					String strErrorMsg =  YoctoSDKUtils.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
+				SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
+				if (result != SDKCheckResults.SDK_PASS){
+					String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
 					throw new YoctoGeneralException(strErrorMsg);
 				}
 				AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] plugins/sdk.ide: Refactored the construction of mesages with SDKCheckResults
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
  2013-02-27 14:37 ` [PATCH 1/5] plugins/sdk.ide: Move SDK check functionality to separate class Timo Mueller
@ 2013-02-27 14:37 ` Timo Mueller
  2013-02-27 14:37 ` [PATCH 3/5] plugins/sdk.ide: Show SDK check errors in message area Timo Mueller
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

The message keys are now stored with the enum values simplifying the
construction of error messages.

Error messages have also been split up into a one line error message
and an advice. The one line error message can for example be used in
UI Parts with limited space (e.g. message area on property and
preference pages). Dialogs or log messages can use the complete
message to give the user a hint on what to do in order to fix the
error.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     | 159 +++++++++------------
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  42 ++++--
 2 files changed, 99 insertions(+), 102 deletions(-)

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 fd50f18..9579021 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
@@ -1,5 +1,7 @@
 /*******************************************************************************
  * Copyright (c) 2010 Intel Corporation.
+ * Copyright (c) 2013 BMW Car IT GmbH.
+ * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +9,7 @@
  *
  * Contributors:
  * Intel - initial API and implementation
+ * BMW Car IT - include error and advice messages with check results
  *******************************************************************************/
 package org.yocto.sdk.ide;
 
@@ -17,45 +20,76 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 
 public class YoctoSDKChecker {
+	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
+	private static final String SYSROOTS_DIR = "sysroots";
 
 	public static enum SDKCheckResults {
-		SDK_PASS,
-		POKY_DEVICE_EMPTY,
-		TOOLCHAIN_LOCATION_EMPTY,
-		TOOLCHAIN_LOCATION_NONEXIST,
-		SDK_TARGET_EMPTY,
-		QEMU_KERNEL_EMPTY,
-		SYSROOT_EMPTY,
-		QEMU_KERNEL_NONEXIST,
-		SYSROOT_NONEXIST,
-		WRONG_ADT_VERSION,
-		ENV_SETUP_SCRIPT_NONEXIST,
-		TOOLCHAIN_NO_SYSROOT,
-		TOOLCHAIN_HOST_MISMATCH
+		SDK_PASS("", false),
+		TOOLCHAIN_LOCATION_EMPTY(
+				"Poky.SDK.Location.Empty", true),
+		TOOLCHAIN_LOCATION_NONEXIST(
+				"Poky.SDK.Location.Nonexist", true),
+		SDK_TARGET_EMPTY(
+				"Poky.SDK.Target.Empty", true),
+		SYSROOT_EMPTY(
+				"Poky.Sysroot.Empty", true),
+		SYSROOT_NONEXIST(
+				"Poky.Sysroot.Nonexist", true),
+		QEMU_KERNEL_EMPTY(
+				"Poky.Qemu.Kernel.Empty", true),
+		QEMU_KERNEL_NONEXIST(
+				"Poky.Qemu.Kernel.Nonexist", true),
+		WRONG_ADT_VERSION(
+				"Poky.ADT.Sysroot.Wrongversion", false),
+		ENV_SETUP_SCRIPT_NONEXIST(
+				"Poky.Env.Script.Nonexist", false),
+		TOOLCHAIN_NO_SYSROOT(
+				"Poky.Toolchain.No.Sysroot", false),
+		TOOLCHAIN_HOST_MISMATCH(
+				"Poky.Toolchain.Host.Mismatch", false);
+
+		private static final String DEFAULT_ADVICE = "Default.Advice";
+		private static final String ADVICE_SUFFIX = ".Advice";
+
+		private final String messageID;
+		private final boolean addDefaultAdvice;
+
+		private SDKCheckResults(final String messageID, final boolean addDefaultAdvice) {
+			this.messageID = messageID;
+			this.addDefaultAdvice = addDefaultAdvice;
+		}
+
+		public String getMessage() {
+			return YoctoSDKMessages.getString(messageID);
+		}
+
+		public String getAdvice() {
+			String advice = YoctoSDKMessages.getString(messageID + ADVICE_SUFFIX);
+
+			if (addDefaultAdvice) {
+				advice += YoctoSDKMessages.getString(DEFAULT_ADVICE);
+			}
+
+			return advice;
+		}
 	};
 
 	public static enum SDKCheckRequestFrom {
-		Wizard,
-		Menu,
-		Preferences,
-		Other
-	};
+		Wizard("Poky.SDK.Error.Origin.Wizard"),
+		Menu("Poky.SDK.Error.Origin.Menu"),
+		Preferences("Poky.SDK.Error.Origin.Preferences"),
+		Other("Poky.SDK.Error.Origin.Other");
 
-	private static final String POKY_DEVICE_EMPTY = "Poky.SDK.Device.Empty";
-	private static final String TOOLCHAIN_LOCATION_EMPTY     = "Poky.SDK.Location.Empty";
-	private static final String SDK_TARGET_EMPTY      = "Poky.SDK.Target.Empty";
-	private static final String TOOLCHAIN_LOCATION_NONEXIST = "Poky.SDK.Location.Nonexist";
-	private static final String QEMU_KERNEL_EMPTY 	  = "Poky.Qemu.Kernel.Empty";
-	private static final String SYSROOT_EMPTY = "Poky.Sysroot.Empty";
-	private static final String QEMU_KERNEL_NONEXIST = "Poky.Qemu.Kernel.Nonexist";
-	private static final String SYSROOT_NONEXIST = "Poky.Sysroot.Nonexist";
-	private static final String WRONG_ADT_VERSION = "Poky.ADT.Sysroot.Wrongversion";
-	private static final String ENV_SETUP_SCRIPT_NONEXIST = "Poky.Env.Script.Nonexist";
-	private static final String TOOLCHAIN_NO_SYSROOT = "Poky.Toolchain.No.Sysroot";
-	private static final String TOOLCHAIN_HOST_MISMATCH = "Poky.Toolchain.Host.Mismatch";
-	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
-	
-	private static final String SYSROOTS_DIR = "sysroots";
+		private final String errorMessageID;
+
+		private SDKCheckRequestFrom(final String errorMessageID) {
+			this.errorMessageID = errorMessageID;
+		}
+
+		public String getErrorMessage() {
+			return YoctoSDKMessages.getString(errorMessageID);
+		}
+	};
 
 	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
 		if (elem.getStrToolChainRoot().isEmpty())
@@ -172,62 +206,9 @@ public class YoctoSDKChecker {
 
 	public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) {
 		String strErrorMsg;
-
-		switch (from) {
-		case Wizard:
-			strErrorMsg = "Yocto Wizard Configuration Error:";
-			break;
-		case Menu:
-			strErrorMsg = "Yocto Menu Configuration Error!";
-			break;
-		case Preferences:
-			strErrorMsg = "Yocto Preferences Configuration Error!";
-			break;
-		default:
-			strErrorMsg = "Yocto Configuration Error!";
-			break;
-		}
-
-		switch (result) {
-		case POKY_DEVICE_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(POKY_DEVICE_EMPTY);
-			break;
-		case TOOLCHAIN_LOCATION_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_EMPTY);
-			break;
-		case SDK_TARGET_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SDK_TARGET_EMPTY);
-			break;
-		case TOOLCHAIN_LOCATION_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_LOCATION_NONEXIST);
-			break;
-		case QEMU_KERNEL_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_EMPTY);
-			break;
-		case SYSROOT_EMPTY:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_EMPTY);
-			break;
-		case QEMU_KERNEL_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(QEMU_KERNEL_NONEXIST);
-			break;
-		case SYSROOT_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(SYSROOT_NONEXIST);
-			break;
-		case WRONG_ADT_VERSION:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(WRONG_ADT_VERSION);
-			break;
-		case ENV_SETUP_SCRIPT_NONEXIST:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(ENV_SETUP_SCRIPT_NONEXIST);
-			break;
-		case TOOLCHAIN_NO_SYSROOT:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_NO_SYSROOT);
-			break;
-		case TOOLCHAIN_HOST_MISMATCH:
-			strErrorMsg = strErrorMsg + "\n" + YoctoSDKMessages.getString(TOOLCHAIN_HOST_MISMATCH);
-			break;
-		default:
-			break;
-		}
+		strErrorMsg = from.getErrorMessage();
+		strErrorMsg += "\n" + result.getMessage();
+		strErrorMsg += "\n" + result.getAdvice();
 
 		return strErrorMsg;
 	}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index e5748f7..4a4fb60 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -11,19 +11,35 @@
  *******************************************************************************/
 Wizard.SDK.Warning.Title = Invalid Yocto Project ADT Location
 
-Poky.SDK.Device.Empty = Please specify External HW IP Adress!
-Poky.SDK.Location.Empty     = You need specify tool-chain location before building any project. \nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.SDK.Target.Empty      =  You need specify Target Architecture before building any project.\nSpecified Location does not contain environment script File!\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.SDK.Location.Nonexist = Specified SDK toolchain directory does not exist!\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings. 
-Poky.Qemu.Kernel.Empty = You need specify Qemu Kernel Image File Location before building any project.\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.Sysroot.Empty = You need specify Sysroot Location before building any project.\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT \nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.Qemu.Kernel.Nonexist = Specified QEMU kernel Image File does not exist!\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT \nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.Sysroot.Nonexist = Specified sysroot directory does not exist!\nDo IDE-wide settings from Window > Preferences > Yocto Project ADT \nOr do Project-wide settings from Project > Change Yocto Project Settings.
-Poky.Env.Script.Nonexist = Specified Build Tree Toolchain Root does not contain any toolchain yet!\nPlease run "bitbake meta-ide-support" to build the toolchain.
-Poky.ADT.Sysroot.Wrongversion = OECORE related items are not found in envrionement setup files.\nThe ADT version you're using is too old.\n Please upgrade to our latest ADT Version!
-Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch.\n Make sure you use 32bit toolchain for 32bit host and same for 64bit machines!
-Poky.Toolchain.No.Sysroot = There's no sysroots directory under your toolchain directory under /opt/poky!
-
+Poky.SDK.Location.Empty = Specified Toolchain Root Location is empty.
+Poky.SDK.Location.Empty.Advice = You need specify Toolchain Root Location before building any project.
+Poky.SDK.Location.Nonexist = Specified SDK toolchain directory does not exist.
+Poky.SDK.Location.Nonexist.Advice = Please specify a valid toolchain directory.
+Poky.SDK.Target.Empty = Specified location does not contain environment script file.
+Poky.SDK.Target.Empty.Advice = You need specify Target Architecture before building any project.
+Poky.Sysroot.Empty = Specified Sysroot Location is empty.
+Poky.Sysroot.Empty.Advice = You need specify Sysroot Location before building any project.
+Poky.Sysroot.Nonexist = Specified Sysroot Location does not exist.
+Poky.Qemu.Kernel.Empty.Advice = You need specify a valid Sysroot Location before building any project.
+Poky.Qemu.Kernel.Empty =  Specified QEMU kernel location is emtpy.
+Poky.Qemu.Kernel.Empty.Advice = You need specify QEMU kernel image file Location before building any project.
+Poky.Qemu.Kernel.Nonexist = Specified QEMU kernel image file does not exist.
+Poky.Qemu.Kernel.Empty.Advice = You need specify a valid QEMU kernel image file before building any project.
+Poky.ADT.Sysroot.Wrongversion = The ADT version you're using is too old.
+Poky.ADT.Sysroot.Wrongversion.Advice = OECORE related items are not found in environment setup files.\nPlease upgrade to our latest ADT Version!
+Poky.Env.Script.Nonexist = Specified Build Tree Toolchain Root does not contain any toolchain yet.
+Poky.Env.Script.Nonexist.Advice = Please run "bitbake meta-ide-support" to build the toolchain.
+Poky.Toolchain.No.Sysroot = Specified Toolchain Root Location does not contain a sysroot directory.
+Poky.Toolchain.No.Sysroot.Advice = Please install a valid toolchain sysroot.
+Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch.
+Poky.Toolchain.Host.Mismatch.Advice = Make sure you use 32bit toolchain for 32bit host and same for 64bit machines!
+
+Default.Advice = \nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings.
+
+Poky.SDK.Error.Origin.Wizard = Yocto Wizard Configuration Error:
+Poky.SDK.Error.Origin.Menu = Yocto Menu Configuration Error:
+Poky.SDK.Error.Origin.Preferences = Yocto Preferences Configuration Error:
+Poky.SDK.Error.Origin.Other = Yocto Configuration Error:
 
 Menu.SDK.Console.Configure.Message    = The Yocto Project ADT has been successfully set up for this project.\nTo see the environment variables created during setup,\ngo to Project > Properties > C/C++ Build > Environment. 
 Menu.SDK.Console.Deploy.Action.Message   = \nDeploying {0} to {1} ...\n
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] plugins/sdk.ide: Show SDK check errors in message area
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
  2013-02-27 14:37 ` [PATCH 1/5] plugins/sdk.ide: Move SDK check functionality to separate class Timo Mueller
  2013-02-27 14:37 ` [PATCH 2/5] plugins/sdk.ide: Refactored the construction of mesages with SDKCheckResults Timo Mueller
@ 2013-02-27 14:37 ` Timo Mueller
  2013-02-27 14:37 ` [PATCH 4/5] plugins/sdk.ide: Removed validation from setCurrentInput Timo Mueller
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

If settings made by the user do not pass the SDK check the error
message was not shown in eclipse but was printed to system out which
was never visible by the user.

The error is now shown in the message area of the property or preference
page if the check fails.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      | 43 ++++-------
 .../ide/preferences/YoctoSDKPreferencePage.java    | 84 ++++++++++-----------
 .../preferences/YoctoSDKProjectPropertyPage.java   | 85 +++++++++++-----------
 3 files changed, 97 insertions(+), 115 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index 74cfd69..2affe82 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -336,40 +336,29 @@ public class YoctoUISetting {
 		textQemuOption.setText(elem.getStrQemuOption());
 		textSysrootLoc.setText(elem.getStrSysrootLoc());
 
-		try {
-			validateInput(SDKCheckRequestFrom.Preferences, false);
-		} catch (YoctoGeneralException e) {
+		SDKCheckResults result = validateInput(SDKCheckRequestFrom.Preferences, false);
+		if (result != SDKCheckResults.SDK_PASS) {
 			System.out.println("Have you ever set Yocto Project Reference before?");
-			System.out.println(e.getMessage());
+			System.out.println(YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Other));
 		}
 	}
 
-	public boolean validateInput(SDKCheckRequestFrom from, boolean bPrompt) throws YoctoGeneralException {
-		YoctoUIElement elem = getCurrentInput();
-		boolean pass = true;
-		String strErrorMessage;
-
-		SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
+	public SDKCheckResults validateInput(SDKCheckRequestFrom from, boolean showErrorDialog) {
+		SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(getCurrentInput());
 
 		//Show Error Message on the Label to help users.
-		if (result != SDKCheckResults.SDK_PASS) {
-			strErrorMessage = YoctoSDKChecker.getErrorMessage(result, from);
-			pass = false;
-			if (bPrompt)
-			{
-				Display display = Display.getCurrent();
-				Shell shell = new Shell(display);
-				MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
-				msgBox.setText("Yocto Project Configuration Error");
-				msgBox.setMessage(strErrorMessage);
-				msgBox.open();
-				if (shell != null)
-					shell.dispose();
-			}
-
-			throw new YoctoGeneralException(strErrorMessage);
+		if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) {
+			Display display = Display.getCurrent();
+			Shell shell = new Shell(display);
+			MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
+			msgBox.setText("Yocto Project Configuration Error");
+			msgBox.setMessage(YoctoSDKChecker.getErrorMessage(result, from));
+			msgBox.open();
+			if (shell != null)
+				shell.dispose();
 		}
-		return pass;
+
+		return result;
 	}
 
 	public void setUIFormEnabledState(boolean isEnabled) {
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index ef681a4..1a8c8ca 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -26,14 +26,14 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.yocto.sdk.ide.YoctoGeneralException;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoProfileSetting;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKUtils;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
@@ -75,60 +75,57 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 	protected Control createContents(Composite parent) {
 		initializeDialogUnits(parent);
-		final Composite result= new Composite(parent, SWT.NONE);
-
-		yoctoProfileSetting.createComposite(result);
-
-		try {
-			yoctoUISetting.createComposite(result);
-			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
-			Dialog.applyDialogFont(result);
-			return result;
-		} catch (YoctoGeneralException e) {
-			System.out.println("Have you ever set Yocto Project Reference before?");
-			System.out.println(e.getMessage());
-			return result;
+		final Composite composite= new Composite(parent, SWT.NONE);
+
+		yoctoProfileSetting.createComposite(composite);
+		yoctoUISetting.createComposite(composite);
+
+		SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
+		if (result != SDKCheckResults.SDK_PASS) {
 		}
+
+		Dialog.applyDialogFont(composite);
+		return composite;
 	}
 
 	/*
 	 * @see IPreferencePage#performOk()
 	 */
 	public boolean performOk() {
-		try {
-			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
+		setErrorMessage(null);
 
-			YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
-			YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput();
+		SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
+		if (result != SDKCheckResults.SDK_PASS) {
+			setErrorMessage(result.getMessage());
+			return false;
+		}
 
-			if (savedElement.equals(modifiedElement)) {
-				return true;
-			}
+		YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
+		YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput();
 
-			YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
-			HashSet<IProject> yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile());
+		if (savedElement.equals(modifiedElement)) {
+			return true;
+		}
+
+		YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
+		HashSet<IProject> yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile());
 
-			if (!yoctoProjects.isEmpty()) {
-				boolean deleteConfirmed =
-						MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE),
-								YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile()));
+		if (!yoctoProjects.isEmpty()) {
+			boolean deleteConfirmed =
+					MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE),
+							YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile()));
 
-				if (!deleteConfirmed) {
-					return false;
-				}
+			if (!deleteConfirmed) {
+				return false;
 			}
+		}
 
-			YoctoSDKUtils.saveElemToStore(modifiedElement, getPreferenceStore());
-			YoctoSDKUtils.saveProfilesToDefaultStore(profileElement);
+		YoctoSDKUtils.saveElemToStore(modifiedElement, getPreferenceStore());
+		YoctoSDKUtils.saveProfilesToDefaultStore(profileElement);
 
-			updateProjects(yoctoProjects, modifiedElement);
+		updateProjects(yoctoProjects, modifiedElement);
 
-			return super.performOk();
-		} catch (YoctoGeneralException e) {
-			// TODO Auto-generated catch block
-			System.out.println(e.getMessage());
-			return false;
-		}
+		return super.performOk();
 	}
 
 	/*
@@ -144,10 +141,9 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 		YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
 		YoctoUIElement uiElement = yoctoUISetting.getCurrentInput();
 
-		try {
-			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
-		} catch (YoctoGeneralException e) {
-			// just abort saving, validateInput will show an error dialog
+		SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
+		if (result != SDKCheckResults.SDK_PASS) {
+			setErrorMessage(result.getMessage());
 			return;
 		}
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
index 551d3bd..ca148af 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
@@ -20,11 +20,11 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbenchPropertyPage;
 import org.eclipse.ui.dialogs.PropertyPage;
-import org.yocto.sdk.ide.YoctoGeneralException;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
@@ -63,32 +63,29 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		yoctoProjectSpecificSetting = new YoctoProjectSpecificSetting(yoctoProfileSetting, yoctoUISetting, this);
 
 		initializeDialogUnits(parent);
-		final Composite result = new Composite(parent, SWT.NONE);
-
-		yoctoProfileSetting.createComposite(result);
-		yoctoProjectSpecificSetting.createComposite(result);
-
-		try {
-			yoctoUISetting.createComposite(result);
-
-			if (useProjectSpecificSetting) {
-				yoctoProfileSetting.setUIFormEnabledState(false);
-				yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true);
-				yoctoUISetting.setUIFormEnabledState(true);
-				yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
-			} else {
-				yoctoProfileSetting.setUIFormEnabledState(true);
-				yoctoProjectSpecificSetting.setUseProjectSpecificSettings(false);
-				yoctoUISetting.setUIFormEnabledState(false);
-			}
+		final Composite composite = new Composite(parent, SWT.NONE);
+
+		yoctoProfileSetting.createComposite(composite);
+		yoctoProjectSpecificSetting.createComposite(composite);
+		yoctoUISetting.createComposite(composite);
+
+		if (useProjectSpecificSetting) {
+			yoctoProfileSetting.setUIFormEnabledState(false);
+			yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true);
+			yoctoUISetting.setUIFormEnabledState(true);
 
-			Dialog.applyDialogFont(result);
-			return result;
-		} catch (YoctoGeneralException e) {
-			System.out.println("Have you ever set Yocto Project Reference before?");
-			System.out.println(e.getMessage());
-			return result;
+			SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
+			if (result != SDKCheckResults.SDK_PASS) {
+				setErrorMessage(result.getMessage());
+			}
+		} else {
+			yoctoProfileSetting.setUIFormEnabledState(true);
+			yoctoProjectSpecificSetting.setUseProjectSpecificSettings(false);
+			yoctoUISetting.setUIFormEnabledState(false);
 		}
+
+		Dialog.applyDialogFont(composite);
+		return composite;
 	}
 
 	private IProject getProject() {
@@ -121,28 +118,28 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 	 */
 	@Override
 	public boolean performOk() {
-		try {
-			IProject project = getProject();
-
-			if (yoctoProjectSpecificSetting.isUsingProjectSpecificSettings()) {
-				yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
-
-				YoctoSDKUtils.saveUseProjectSpecificOptionToProjectPreferences(project, true);
-				YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
-				YoctoSDKUtils.saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
-			} else {
-				YoctoSDKUtils.saveUseProjectSpecificOptionToProjectPreferences(project, false);
-				YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
-			}
+		setErrorMessage(null);
+
+		IProject project = getProject();
 
-			YoctoSDKUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
+		if (yoctoProjectSpecificSetting.isUsingProjectSpecificSettings()) {
+			SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
+			if (result != SDKCheckResults.SDK_PASS) {
+				setErrorMessage(result.getMessage());
+				return false;
+			}
 
-			return super.performOk();
-		} catch (YoctoGeneralException e) {
-			// TODO Auto-generated catch block
-			System.out.println(e.getMessage());
-			return false;
+			YoctoSDKUtils.saveUseProjectSpecificOptionToProjectPreferences(project, true);
+			YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
+			YoctoSDKUtils.saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
+		} else {
+			YoctoSDKUtils.saveUseProjectSpecificOptionToProjectPreferences(project, false);
+			YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
 		}
+
+		YoctoSDKUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
+
+		return super.performOk();
 	}
 
 	public void switchProfile(String selectedProfile)
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] plugins/sdk.ide: Removed validation from setCurrentInput
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
                   ` (2 preceding siblings ...)
  2013-02-27 14:37 ` [PATCH 3/5] plugins/sdk.ide: Show SDK check errors in message area Timo Mueller
@ 2013-02-27 14:37 ` Timo Mueller
  2013-02-27 14:37 ` [PATCH 5/5] plugins/sdk.ide: Use standard error dialog to show SDK check errors Timo Mueller
  2013-02-27 22:04 ` [PATCH 0/5][eclipse-poky] Refactor handling of " Zhang, Jessica
  5 siblings, 0 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

The result of the validation did not affect the behaviour of the
method. Also an error is not reported back to the caller or the
user. Validation of the setting should be handled before setting the
input or on save.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index 2affe82..ba80cb1 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -335,12 +335,6 @@ public class YoctoUISetting {
 		textKernelLoc.setText(elem.getStrQemuKernelLoc());
 		textQemuOption.setText(elem.getStrQemuOption());
 		textSysrootLoc.setText(elem.getStrSysrootLoc());
-
-		SDKCheckResults result = validateInput(SDKCheckRequestFrom.Preferences, false);
-		if (result != SDKCheckResults.SDK_PASS) {
-			System.out.println("Have you ever set Yocto Project Reference before?");
-			System.out.println(YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Other));
-		}
 	}
 
 	public SDKCheckResults validateInput(SDKCheckRequestFrom from, boolean showErrorDialog) {
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] plugins/sdk.ide: Use standard error dialog to show SDK check errors
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
                   ` (3 preceding siblings ...)
  2013-02-27 14:37 ` [PATCH 4/5] plugins/sdk.ide: Removed validation from setCurrentInput Timo Mueller
@ 2013-02-27 14:37 ` Timo Mueller
  2013-02-27 22:04 ` [PATCH 0/5][eclipse-poky] Refactor handling of " Zhang, Jessica
  5 siblings, 0 replies; 9+ messages in thread
From: Timo Mueller @ 2013-02-27 14:37 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>


Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java            | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index ba80cb1..f27019d 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -14,6 +14,8 @@ import java.io.File;
 import java.util.ArrayList;
 
 import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -32,8 +34,6 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.swt.widgets.Widget;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
@@ -343,13 +343,11 @@ public class YoctoUISetting {
 		//Show Error Message on the Label to help users.
 		if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) {
 			Display display = Display.getCurrent();
-			Shell shell = new Shell(display);
-			MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
-			msgBox.setText("Yocto Project Configuration Error");
-			msgBox.setMessage(YoctoSDKChecker.getErrorMessage(result, from));
-			msgBox.open();
-			if (shell != null)
-				shell.dispose();
+			ErrorDialog.openError(display.getActiveShell(),
+									"Yocto Project Configuration Error",
+									YoctoSDKChecker.getErrorMessage(result, from),
+									new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage()));
+
 		}
 
 		return result;
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors
  2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
                   ` (4 preceding siblings ...)
  2013-02-27 14:37 ` [PATCH 5/5] plugins/sdk.ide: Use standard error dialog to show SDK check errors Timo Mueller
@ 2013-02-27 22:04 ` Zhang, Jessica
  2013-03-01  9:37   ` Timo Müller
  5 siblings, 1 reply; 9+ messages in thread
From: Zhang, Jessica @ 2013-02-27 22:04 UTC (permalink / raw)
  To: Timo Mueller, yocto@yoctoproject.org; +Cc: Timo Mueller

Hi Timo,

Thanks for initiating the cleanup in this area that I agree definitely need some work.  There're couple issues I'm seeing with your patch set that probably need some refinements:

1. After seeing the error message, if I go into the field correct the error, I have to explicit click on "Apply" to make it revalidate, probably we should track the fields change and do automatic re-validation

2. For a scenario that I have 2 toolchains (for different arch, e.g. arm and x86) installed under same directory, which means there're 2 environment setup scripts under the same directory.  In this case, the Target Architecture drop down list will contain 2 entries for the arches.  In this case, I'm getting an error message for missing environment script file which is not true.  By looking at the code, the logic basically checking the elem's target architecture setting, if there's none, report missing environment script.  I think for this case, we do need to check the size of the target arch option list to see whether it's empty or not.

3. For the case of Poky.Env.Script.Nonexist, there's Poky.Env.ScriptNoexist.Advise which is more meaningful to user what to do if running into the error.  But I don't see that Advice is posted and by looking at code, it seems it's not being used as well?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Timo Mueller
Sent: Wednesday, February 27, 2013 6:37 AM
To: yocto@yoctoproject.org
Cc: Timo Mueller
Subject: [yocto] [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors

From: Timo Mueller <timo.mueller@bmw-carit.de>

Hi,

I tried to display the messages resulting from validating the YoctoUISettings in the message area of the properties/preference pages instead of showing a dialog. This led to some refactoring of the validation functionality and also the messages.

If for example the user entered a SDK toolchain directory that doesn't exist in the global preferences a dialog will show up showing the error and telling him how he can do "IDE-wide settings". As he is currently trying to do "IDE-wide settings" this advice is not really necessary and the dialog can be really annoying.

I split up the messages into a one line error message and an advice. This message can be shown in the page's message area instead of opening a dialog with every configuration error. The advice can still be used when we want to show a dialog to help the user, e.g. when creating a new project.

On a side note I reactivated the YoctoSDKChecker class and moved all the validation code from the utils, getting rid of some duplicated and inconsistent code.

Best regards,
Timo

PS: This patch set is based on "plugins/sdk.ide: Remove profile edit buttons from property page"

Timo Mueller (5):
  plugins/sdk.ide: Move SDK check functionality to separate class
  plugins/sdk.ide: Refactored the construction of mesages with
    SDKCheckResults
  plugins/sdk.ide: Show SDK check errors in message area
  plugins/sdk.ide: Removed validation from setCurrentInput
  plugins/sdk.ide: Use standard error dialog to show SDK check errors

 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     | 372 +++++++++++----------
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  42 ++-
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |   9 +-
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       | 255 --------------
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |  47 +--
 .../ide/preferences/YoctoSDKPreferencePage.java    |  84 +++--
 .../preferences/YoctoSDKProjectPropertyPage.java   |  87 +++--
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |  18 +-
 8 files changed, 344 insertions(+), 570 deletions(-)

--
1.7.11.7

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors
  2013-02-27 22:04 ` [PATCH 0/5][eclipse-poky] Refactor handling of " Zhang, Jessica
@ 2013-03-01  9:37   ` Timo Müller
  2013-03-04 19:55     ` Zhang, Jessica
  0 siblings, 1 reply; 9+ messages in thread
From: Timo Müller @ 2013-03-01  9:37 UTC (permalink / raw)
  To: Zhang, Jessica; +Cc: yocto@yoctoproject.org, Timo Mueller

Hi Jessica,

Zhang, Jessica wrote, On 27.02.2013 23:04:
> Hi Timo,
>
> Thanks for initiating the cleanup in this area that I agree
> definitely need some work.  There're couple issues I'm seeing with
> your patch set that probably need some refinements:
>
> 1. After seeing the error message, if I go into the field correct the
> error, I have to explicit click on "Apply" to make it revalidate,
> probably we should track the fields change and do automatic
> re-validation

Yes, I agree it can be confusing. I already played around with enabling 
Listeners on the YoctoUISetting element but stopped because I thought 
that rechecking the SDK everytime you type in a new character will slow 
down the ui to much.

One idea I have in mind is, if the settings are changed (on type) we 
delete the error message and show a message telling the user that the 
new settings have to be revalidated again. Do you think that would be 
sufficient?

Nevertheless I will extend the YoctoUISetting to be able to notify 
registered listeners on change. Then we can decide on how we want to 
react to this change.

>
> 2. For a scenario that I have 2 toolchains (for different arch, e.g.
> arm and x86) installed under same directory, which means there're 2
> environment setup scripts under the same directory.  In this case,
> the Target Architecture drop down list will contain 2 entries for the
> arches.  In this case, I'm getting an error message for missing
> environment script file which is not true.  By looking at the code,
> the logic basically checking the elem's target architecture setting,
> if there's none, report missing environment script.  I think for this
> case, we do need to check the size of the target arch option list to
> see whether it's empty or not.

True, this calls for a separate error message.

>
> 3. For the case of Poky.Env.Script.Nonexist, there's
> Poky.Env.ScriptNoexist.Advise which is more meaningful to user what
> to do if running into the error.  But I don't see that Advice is
> posted and by looking at code, it seems it's not being used as well?

I'll try to rephrase the error message.

Regarding the advice I'm not quite sure if I follow correctly. If you 
choose "Build system derived toolchain" and the location doesn't contain 
a toolchain (so the drop-down is empty) the SDK check fails with 
ENV_SETUP_SCRIPT_NONEXIST. If a dialog pops up showing the error, the 
advice will also be used and added to the message.

>
> Thanks, Jessica
>
> -----Original Message----- From: yocto-bounces@yoctoproject.org
> [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Timo Mueller
> Sent: Wednesday, February 27, 2013 6:37 AM To:
> yocto@yoctoproject.org Cc: Timo Mueller Subject: [yocto] [PATCH
> 0/5][eclipse-poky] Refactor handling of SDK check errors
>
> From: Timo Mueller <timo.mueller@bmw-carit.de>
>
> Hi,
>
> I tried to display the messages resulting from validating the
> YoctoUISettings in the message area of the properties/preference
> pages instead of showing a dialog. This led to some refactoring of
> the validation functionality and also the messages.
>
> If for example the user entered a SDK toolchain directory that
> doesn't exist in the global preferences a dialog will show up showing
> the error and telling him how he can do "IDE-wide settings". As he is
> currently trying to do "IDE-wide settings" this advice is not really
> necessary and the dialog can be really annoying.
>
> I split up the messages into a one line error message and an advice.
> This message can be shown in the page's message area instead of
> opening a dialog with every configuration error. The advice can still
> be used when we want to show a dialog to help the user, e.g. when
> creating a new project.
>
> On a side note I reactivated the YoctoSDKChecker class and moved all
> the validation code from the utils, getting rid of some duplicated
> and inconsistent code.
>
> Best regards, Timo
>
> PS: This patch set is based on "plugins/sdk.ide: Remove profile edit
> buttons from property page"

Best regards
Timo




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors
  2013-03-01  9:37   ` Timo Müller
@ 2013-03-04 19:55     ` Zhang, Jessica
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang, Jessica @ 2013-03-04 19:55 UTC (permalink / raw)
  To: Timo Müller; +Cc: yocto@yoctoproject.org, Timo Mueller

Comments below...

Thanks,
Jessica

-----Original Message-----
From: Timo Müller [mailto:mail@timomueller.eu]
Sent: Friday, March 01, 2013 1:37 AM
To: Zhang, Jessica
Cc: yocto@yoctoproject.org; Timo Mueller
Subject: Re: [yocto] [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors

Hi Jessica,

Zhang, Jessica wrote, On 27.02.2013 23:04:
> Hi Timo,
>
> Thanks for initiating the cleanup in this area that I agree definitely
> need some work.  There're couple issues I'm seeing with your patch set
> that probably need some refinements:
>
> 1. After seeing the error message, if I go into the field correct the
> error, I have to explicit click on "Apply" to make it revalidate,
> probably we should track the fields change and do automatic
> re-validation

Yes, I agree it can be confusing. I already played around with enabling Listeners on the YoctoUISetting element but stopped because I thought that rechecking the SDK everytime you type in a new character will slow down the ui to much.
[JZ] yeah that's my concern too....

One idea I have in mind is, if the settings are changed (on type) we delete the error message and show a message telling the user that the new settings have to be revalidated again. Do you think that would be sufficient?
[JZ] this sounds reasonable

Nevertheless I will extend the YoctoUISetting to be able to notify registered listeners on change. Then we can decide on how we want to react to this change.

>
> 2. For a scenario that I have 2 toolchains (for different arch, e.g.
> arm and x86) installed under same directory, which means there're 2
> environment setup scripts under the same directory.  In this case,
> the Target Architecture drop down list will contain 2 entries for the
> arches.  In this case, I'm getting an error message for missing
> environment script file which is not true.  By looking at the code,
> the logic basically checking the elem's target architecture setting,
> if there's none, report missing environment script.  I think for this
> case, we do need to check the size of the target arch option list to
> see whether it's empty or not.

True, this calls for a separate error message.

>
> 3. For the case of Poky.Env.Script.Nonexist, there's
> Poky.Env.ScriptNoexist.Advise which is more meaningful to user what
> to do if running into the error.  But I don't see that Advice is
> posted and by looking at code, it seems it's not being used as well?

I'll try to rephrase the error message.

Regarding the advice I'm not quite sure if I follow correctly. If you
choose "Build system derived toolchain" and the location doesn't contain
a toolchain (so the drop-down is empty) the SDK check fails with
ENV_SETUP_SCRIPT_NONEXIST. If a dialog pops up showing the error, the
advice will also be used and added to the message.

[JZ] Yes, only for build tree derived toolchain, the mechanism for build the toolchain thus having the environment setup script is via "bitbake meta-ide-support" so we need to explicitly tell people what to do if they run into this error.

>
> Thanks, Jessica
>
> -----Original Message----- From: yocto-bounces@yoctoproject.org
> [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Timo Mueller
> Sent: Wednesday, February 27, 2013 6:37 AM To:
> yocto@yoctoproject.org Cc: Timo Mueller Subject: [yocto] [PATCH
> 0/5][eclipse-poky] Refactor handling of SDK check errors
>
> From: Timo Mueller <timo.mueller@bmw-carit.de>
>
> Hi,
>
> I tried to display the messages resulting from validating the
> YoctoUISettings in the message area of the properties/preference
> pages instead of showing a dialog. This led to some refactoring of
> the validation functionality and also the messages.
>
> If for example the user entered a SDK toolchain directory that
> doesn't exist in the global preferences a dialog will show up showing
> the error and telling him how he can do "IDE-wide settings". As he is
> currently trying to do "IDE-wide settings" this advice is not really
> necessary and the dialog can be really annoying.
>
> I split up the messages into a one line error message and an advice.
> This message can be shown in the page's message area instead of
> opening a dialog with every configuration error. The advice can still
> be used when we want to show a dialog to help the user, e.g. when
> creating a new project.
>
> On a side note I reactivated the YoctoSDKChecker class and moved all
> the validation code from the utils, getting rid of some duplicated
> and inconsistent code.
>
> Best regards, Timo
>
> PS: This patch set is based on "plugins/sdk.ide: Remove profile edit
> buttons from property page"

Best regards
Timo




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-03-04 19:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 14:37 [PATCH 0/5][eclipse-poky] Refactor handling of SDK check errors Timo Mueller
2013-02-27 14:37 ` [PATCH 1/5] plugins/sdk.ide: Move SDK check functionality to separate class Timo Mueller
2013-02-27 14:37 ` [PATCH 2/5] plugins/sdk.ide: Refactored the construction of mesages with SDKCheckResults Timo Mueller
2013-02-27 14:37 ` [PATCH 3/5] plugins/sdk.ide: Show SDK check errors in message area Timo Mueller
2013-02-27 14:37 ` [PATCH 4/5] plugins/sdk.ide: Removed validation from setCurrentInput Timo Mueller
2013-02-27 14:37 ` [PATCH 5/5] plugins/sdk.ide: Use standard error dialog to show SDK check errors Timo Mueller
2013-02-27 22:04 ` [PATCH 0/5][eclipse-poky] Refactor handling of " Zhang, Jessica
2013-03-01  9:37   ` Timo Müller
2013-03-04 19:55     ` Zhang, Jessica

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.