Remove file counting (too slow performance on slow drive connections). See bug 9997.
authortimkelly
Mon, 02 Nov 2009 09:48:03 -0600
changeset 559 9198c2581dd6
parent 555 dc7d28d9b911
child 560 1734d2cdd72f
Remove file counting (too slow performance on slow drive connections). See bug 9997.
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Mon Nov 02 08:19:18 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Mon Nov 02 09:48:03 2009 -0600
@@ -52,7 +52,6 @@
     private Text projectName;
     private Text rootDirectory;
     private Button browseButton;
-    private long MAX_FILE_COUNT_UNDER_ROOT = 20000;
     
     String projectNameText = ""; //$NON-NLS-1$
     IPath rootDirectoryPath = null;
@@ -254,40 +253,25 @@
 			return true;
 		}
 		
-		if (rootDirectoryPath.isRoot()){
-			long resCount = countFilesRecursivelyWithMax(rootDirectoryPath.toFile(), 0);
-			// Don't show warning, if by chance there's few sources under the root
-			if (resCount >= MAX_FILE_COUNT_UNDER_ROOT){
+		if (rootDirectoryPath.isRoot() || rootDirectoryPath.segmentCount() == 1){
+				
+			if (rootDirectoryPath.segmentCount() == 1){
+				for (ISymbianBuildContext context : parsedWithConfigs){
+					IPath sdkRoot = new Path(context.getSDK().getEPOCROOT());
+					if (rootDirectoryPath.isPrefixOf(sdkRoot) || sdkRoot.isPrefixOf(rootDirectoryPath)){
+						setMessage(Messages.ProjectPropertiesPage_directoryIsRoot, IStatus.WARNING);
+						break;
+					}
+				}
+			} else {
 				setMessage(Messages.ProjectPropertiesPage_directoryIsRoot, IStatus.WARNING);
 			}
-			return true;
+			
 		}
 		
 		return true;
     }
     
-    /**
-     * Recursively count the # of files under a given directory. Stops counting when count >= MAX_FILE_COUNT_UNDER_ROOT
-     * @param directory - Start directory
-     * @param start count, current count
-     * @return
-     */
-    private long countFilesRecursivelyWithMax(File directory, long inCount) {
-    	if (inCount >= MAX_FILE_COUNT_UNDER_ROOT) 
-    		return MAX_FILE_COUNT_UNDER_ROOT;
-    	if (directory.isDirectory()) {
-            String[] children = directory.list();
-            inCount = children.length + inCount; // increment the file count for this directory
-            for (int i=0; i<children.length; i++) {
-            	inCount = countFilesRecursivelyWithMax(new File(directory, children[i]), inCount);
-            }
-
-            return inCount; // return current file count
-        }
-    	return inCount; // return current file count
-
-	}
-    
     public String getProjectName() {
     	return projectNameText;
     }
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties	Mon Nov 02 08:19:18 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties	Mon Nov 02 09:48:03 2009 -0600
@@ -17,7 +17,7 @@
 ProjectPropertiesPage_directoryDoesNotContainRequiredFiles=The root directory must contain all project files (bld.inf, mmp and make files).  Click the help icon and select 'Troubleshooting' for more information.
 ProjectPropertiesPage_directoryDoesNotContainSourceFiles=The root directory specified does not contain all the source and resource files referenced in the project.  This may make navigation and editing more difficult.  
 ProjectPropertiesPage_directoryTooLong=The root directory specified is too long.  It cannot exceed 215 characters so that project settings files do not exceed the 256 character path limit.
-ProjectPropertiesPage_directoryIsRoot=Importing a project at root is not recommended. Please select another root or import a subset of included bld.inf files (if possible).
+ProjectPropertiesPage_directoryIsRoot=Importing a project at root or next to root is not recommended. Please select another root or import a subset of included bld.inf files (if possible).
 MMPSelectionPage_title=MMP Selection
 MMPSelectionPage_description=Select the mmp and extension make files to work with.  You will be able to edit this after the project has been created.
 MMPSelectionPage_selectAllAButtonLabel=Select All