move string utility function into utils class
authordadubrow
Wed, 24 Jun 2009 08:09:39 -0500
changeset 293 66f0aa64d141
parent 292 5e058b18fa8c
child 294 652205e6022b
move string utility function into utils class
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java
core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Tue Jun 23 14:33:56 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Wed Jun 24 08:09:39 2009 -0500
@@ -1235,7 +1235,7 @@
 
 		for (IMMPReference mmp : mmps) {
 			if (buildConfiguration != null) {
-				if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.getPath().lastSegment())) { 
+				if (buildComponents == null || TextUtils.listContainsIgnoreCase(buildComponents, mmp.getPath().lastSegment())) { 
 					getMMPIncludePaths(projectInfo.getProject(), 
 							mmp.getPath(), buildConfiguration, userPaths, systemPaths);
 				}
@@ -1462,7 +1462,7 @@
 			buildComponents = info.isBuildingFromInf() ? null : info.getInfBuildComponents();
 	
 		for (IMMPReference mmp : mmps) {
-			if (buildComponents != null && !EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.getPath().lastSegment()))
+			if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmp.getPath().lastSegment()))
 				continue;
 			
 			EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject());
@@ -1587,14 +1587,6 @@
 		return plugin.getPluginPreferences().getBoolean("indexAll"); //$NON-NLS-1$
 	}
 
-	public static boolean containsStringIgnoreCase(List<String> list, String s) {
-		for (String string : list) {
-			if (string.equalsIgnoreCase(s))
-				return true;
-		}
-		return false;
-	}
-
 	/**
 	 * Get the list of all mmp file paths for any and all build configurations of a project.
 	 * @param projectInfo
@@ -2012,7 +2004,7 @@
 			buildComponents = buildConfig.getCarbideProject().isBuildingFromInf() ? null : buildConfig.getCarbideProject().getInfBuildComponents();
 
 		for (IPath mmpPath : getMMPFilesForBuildConfiguration(buildConfig)) {
-			if (buildComponents != null && !containsStringIgnoreCase(buildComponents, mmpPath.lastSegment()))
+			if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmpPath.lastSegment()))
 				continue;
 			
 			EpocEnginePlugin.runWithMMPData(mmpPath, 
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java	Tue Jun 23 14:33:56 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java	Wed Jun 24 08:09:39 2009 -0500
@@ -47,6 +47,7 @@
 import com.nokia.carbide.cdt.builder.EpocEngineHelper;
 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
 
 /**
  * Class used to supply the new CDT 4.0 project model with the data it
@@ -251,7 +252,7 @@
 			buildComponents = carbideBuildConfig.getCarbideProject().isBuildingFromInf() ? null : carbideBuildConfig.getCarbideProject().getInfBuildComponents();
 
 		for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig)) {
-			if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment()))
+			if (buildComponents == null || TextUtils.listContainsIgnoreCase(buildComponents, mmpPath.lastSegment()))
 				EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList);
 		}
 
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java	Tue Jun 23 14:33:56 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java	Wed Jun 24 08:09:39 2009 -0500
@@ -35,8 +35,7 @@
 import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
 import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
-import com.nokia.cpp.internal.api.utils.core.FileUtils;
-import com.nokia.cpp.internal.api.utils.core.MultiResourceChangeListenerDispatcher;
+import com.nokia.cpp.internal.api.utils.core.*;
 import com.nokia.cpp.internal.api.utils.core.MultiResourceChangeListenerDispatcher.IResourceChangeHandler;
 
 /**
@@ -343,7 +342,7 @@
 				buildComponents = config.getCarbideProject().isBuildingFromInf() ? null : config.getCarbideProject().getInfBuildComponents();
 
 			for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(config)) {
-				if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment()))
+				if (buildComponents == null || TextUtils.listContainsIgnoreCase(buildComponents, mmpPath.lastSegment()))
 					EpocEngineHelper.addIncludedFilesFromMMP(cpi, config, mmpPath, pathList);
 			}
 		}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Tue Jun 23 14:33:56 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Wed Jun 24 08:09:39 2009 -0500
@@ -36,6 +36,7 @@
 import com.nokia.carbide.cpp.sdk.core.IBSFPlatform;
 import com.nokia.carbide.cpp.sdk.core.ISBVPlatform;
 import com.nokia.cpp.internal.api.utils.core.FileUtils;
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
 /**
  * Part of the new CDT 4.0 project model requirements.  All this class
  * really does is provide path entries for this build configuration to CDT.
@@ -270,7 +271,7 @@
 		if (cpi.shouldUseMMPMacros()) {
 			List<IPath> mmps = EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig);
 			for (IPath mmp : mmps) {
-				if (buildComponents != null && !EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.lastSegment()))
+				if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmp.lastSegment()))
 					continue;
 				
 				List<String> mmpMacros = EpocEngineHelper.getMMPMacrosForBuildConfiguration(mmp, carbideBuildConfig);
@@ -291,7 +292,7 @@
 		EpocEngineHelper.addIncludedFilesFromBldInf(cpi, carbideBuildConfig, cpi.getAbsoluteBldInfPath(), pathList);
 
 		for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig)) {
-			if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment()))
+			if (buildComponents == null || TextUtils.listContainsIgnoreCase(buildComponents, mmpPath.lastSegment()))
 				EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList);
 		}
 
--- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java	Tue Jun 23 14:33:56 2009 -0500
+++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java	Wed Jun 24 08:09:39 2009 -0500
@@ -555,4 +555,20 @@
 		}
 		return builder.toString();
 	}
+
+	/**
+	 * Returns true if s is contained in list when case is ignored.
+	 * 
+	 * @param list
+	 * @param s
+	 * @return boolean
+	 */
+	public static boolean listContainsIgnoreCase(List<String> list, String s) {
+		for (String string : list) {
+			if (string.equalsIgnoreCase(s))
+				return true;
+		}
+		return false;
+	}
+
 }