[yocto] [PATCH 4/7] plugins/sdk.ide: Moved a locally used method

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


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

The method splitString(...) is used only locally.
Removed from the YoctoSDKUtils in order to
simplify the overpopulated YoctoSDKUtils
class.
---
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   21 +++++++++++++++++---
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |   12 -----------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
index b8d6e8b..fb53c53 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
@@ -51,13 +51,28 @@ public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature {
 		String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
 
 		cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-		cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
-		cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
-		cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
+		cfg.setOption(DEFAULT_BUILD_STR, splitString(strConfigure, "--build="));
+		cfg.setOption(DEFAULT_HOST_STR, splitString(strConfigure, "--host="));
+		cfg.setOption(DEFAULT_TARGET_STR, splitString(strConfigure, "--target="));
 		cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
 		cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
 
 		AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
 		AutotoolsConfigurationManager.getInstance().saveConfigs(project);
 	}
+
+	private static String splitString(String strValue, String strDelim) {
+		int iBeginIndex = strValue.indexOf(strDelim);
+
+		if (iBeginIndex < 0) {
+			return "";
+		}
+		int iEndIndex = strValue.indexOf(' ', iBeginIndex + 1);
+
+		if (iEndIndex < 0) {
+			return strValue.substring(iBeginIndex + strDelim.length());
+		} else {
+			return strValue.substring(iBeginIndex + strDelim.length(), iEndIndex);
+		}
+	}
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
index 5400a42..f257e06 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
@@ -592,18 +592,6 @@ public class YoctoSDKUtils {
 			qemu_target = "qemuppc";
 		return qemu_target;
 	}
-	public static String splitString(String strValue, String strDelim)
-	{
-		int iBeginIndex = strValue.indexOf(strDelim);
-		if (iBeginIndex < 0)
-			return "";
-		int iEndIndex = strValue.indexOf(' ', iBeginIndex + 1);
-
-		if (iEndIndex < 0)
-			return strValue.substring(iBeginIndex + strDelim.length());
-		else
-			return strValue.substring(iBeginIndex + strDelim.length(), iEndIndex);
-	}
 
 	public static HashMap<String, String> parseEnvScript(String sFileName)
 	{
-- 
1.7.9.5




More information about the yocto mailing list