# HG changeset patch # User timkelly # Date 1256930346 18000 # Node ID 4e206437612c86d7d73a99f1a5d1b010bff49a44 # Parent 11d5008fa6c70b94ce38ce4d28a5592ecd95ed47# Parent fe69ca72a1a08d271ce6aadfd95cda91c3c18287 merge commit diff -r 11d5008fa6c7 -r 4e206437612c project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Fri Oct 30 11:34:42 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Fri Oct 30 14:19:06 2009 -0500 @@ -108,6 +108,8 @@ public static String ProjectPropertiesPage_directoryDoesNotContainSourceFiles; public static String ProjectPropertiesPage_directoryTooLong; + + public static String ProjectPropertiesPage_directoryIsRoot; static { // initialize resource bundle diff -r 11d5008fa6c7 -r 4e206437612c project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Fri Oct 30 11:34:42 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Fri Oct 30 14:19:06 2009 -0500 @@ -16,29 +16,43 @@ */ package com.nokia.carbide.cpp.internal.project.ui.importWizards; -import com.nokia.carbide.cdt.builder.EpocEngineHelper; -import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.List; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; -import java.lang.reflect.InvocationTargetException; -import java.util.List; +import com.nokia.carbide.cdt.builder.EpocEngineHelper; +import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; public class ProjectPropertiesPage extends WizardPage implements Listener { 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; @@ -240,9 +254,40 @@ 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){ + 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