[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

  • From: Alexander Simon < >
  • To:
  • Subject: [hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...
  • Date: Tue, 19 Feb 2013 04:08:36 -0800

changeset 1b5e1a3a4d97 in cnd-main ((none))
details: http://hg.netbeans.org/cnd-main/rev/1b5e1a3a4d97
description:
        fixing Bug #225299 Detect C/C++ specific performance problem
        - smooth project creating: additional progress on creating 
configuration step
        - work around 226288
        - change recursive source visitor on layer-by-layer source visitor
        - fix detector messages

diffstat:

 cnd.discovery/nbproject/project.xml                                          
                                |    2 +-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/NotifyProjectProblem.java
                   |    6 +-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
               |   10 +-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/ImportProject.java
                        |   15 +-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/Bundle.properties
                         |   55 +--
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/DiscoveryProjectGeneratorImpl.java
  |   19 +-
 cnd.makeproject/nbproject/project.properties                                 
                                |    2 +-
 
cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java
           |    2 +-
 
cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java
 |  206 +++++----
 cnd.remote.projectui/nbproject/project.xml                                   
                                |    2 +-
 
cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/Bundle.properties
              |    2 +
 
cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/ImportRemoteProject.java
       |   29 +-
 12 files changed, 190 insertions(+), 160 deletions(-)

diffs (656 lines):

diff --git a/cnd.discovery/nbproject/project.xml 
b/cnd.discovery/nbproject/project.xml
--- a/cnd.discovery/nbproject/project.xml
+++ b/cnd.discovery/nbproject/project.xml
@@ -56,7 +56,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>2</release-version>
-                        <specification-version>2.33</specification-version>
+                        <specification-version>2.36</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/NotifyProjectProblem.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/NotifyProjectProblem.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/NotifyProjectProblem.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/NotifyProjectProblem.java
@@ -60,17 +60,17 @@
 @Messages({
     "NotifyProjectProblem.title.text=Detected Project Performance Issues"
     ,"NotifyProjectProblem.action.text=details"
-    ,"NotifyProjectProblem.open.message.text=Slow Project Opening"
+    ,"NotifyProjectProblem.open.message.text=Slow File System"
     ,"# {0} - details"
     ,"NotifyProjectProblem.open.explanation.text=The IDE has detected 
slowness while opening the project.<br>\n"
                                                +"Details:<br>\n"
                                                +"{0}"
-    ,"NotifyProjectProblem.read.message.text=Slow Project Files Reading"
+    ,"NotifyProjectProblem.read.message.text=Slow File System"
     ,"# {0} - details"
     ,"NotifyProjectProblem.read.explanation.text=The IDE has detected 
slowness while reading project files.<br>\n"
                                                +"Details:<br>\n"
                                                +"{0}"
-    ,"NotifyProjectProblem.parse.message.text=Slow Project Parsing"
+    ,"NotifyProjectProblem.parse.message.text=Slow File System"
     ,"# {0} - details"
     ,"NotifyProjectProblem.parse.explanation.text=The IDE has detected 
slowness while parsing project files.<br>\n"
                                                 +"Details:<br>\n"
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
@@ -435,6 +435,10 @@
         return true;
     }
     
+    private boolean alreadyNotified() {
+        return slowFileRead || slowItemCreation || slowParsed;
+    }
+    
     private void notifyProblem(final int problem, final String details) {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
@@ -546,7 +550,7 @@
         long wallTime = time/NANO_TO_SEC;
         long creationSpeed = (itemCount*NANO_TO_SEC)/time;
         if (wallTime > 15 && itemCount > 100 && creationSpeed < 
CREATION_SPEED_LIMIT) {
-            if (!slowItemCreation) {
+            if (!alreadyNotified()) {
                 slowItemCreation = true;
                 final String details = 
Bundle.Details_slow_item_creation(format(wallTime), format(itemCount), 
format(creationSpeed), format(CREATION_SPEED_LIMIT));
                 if (!CndUtils.isUnitTestMode() && !CndUtils.isStandalone() 
&& canNotify()) {
@@ -591,7 +595,7 @@
         long wallTime = time/NANO_TO_SEC;
         long readSpeed = (read*1000*1000)/time;
         if (wallTime > 100 && fileCount > 100 && readSpeed < 
READING_SPEED_LIMIT) {
-            if (!slowFileRead) {
+            if (!alreadyNotified()) {
                 slowFileRead = true;
                 final String details = 
Bundle.Details_slow_file_read(format(wallTime), format(read/1000), 
format(readSpeed), format(READING_SPEED_LIMIT));
                 if (!CndUtils.isUnitTestMode() && !CndUtils.isStandalone() 
&& canNotify()) {
@@ -645,7 +649,7 @@
         if (cpuTime > 1) {
             long k = time/cpu;
             if (wallTime > 100 && fileCount > 100 && parseSpeed < 1000 && k 
> 5) {
-                if (!slowParsed) {
+                if (!alreadyNotified()) {
                     slowParsed = true;
                     final String details = 
Bundle.Details_slow_file_parse(format(wallTime), format(lines), 
format(parseSpeed), format(cpuTime), format(k), format(RATIO_LIMIT));
                     if (!CndUtils.isUnitTestMode() && 
!CndUtils.isStandalone() && canNotify()) {
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/ImportProject.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/ImportProject.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/ImportProject.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/ImportProject.java
@@ -61,6 +61,7 @@
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.logging.Level;
@@ -193,7 +194,7 @@
     private String sourceFoldersFilter = null;
     private FileObject configureFileObject;
     private Map<Step, State> importResult = new EnumMap<Step, 
State>(Step.class);
-    private Task initSourceRootTask;
+    private final CountDownLatch waitSources = new CountDownLatch(1);
 
     public ImportProject(WizardDescriptor wizard) {
         pathMode = MakeProjectOptions.getPathMode();
@@ -413,18 +414,21 @@
             if (pdp.gotDescriptor()) {
                 final MakeConfigurationDescriptor configurationDescriptor = 
pdp.getConfigurationDescriptor();
                 if (sources != null) {
-                    initSourceRootTask = RP.post(new Runnable() {
+                    RP.post(new Runnable() {
                         @Override
                         public void run() {
                             ProgressHandle handle = 
ProgressHandleFactory.createHandle(NbBundle.getMessage(ImportProject.class, 
"ImportProject.Progress.AnalyzeRoot"));
                             handle.start();
                             while(sources.hasNext()) {
                                 SourceFolderInfo next = sources.next();
-                                
configurationDescriptor.addFilesFromRoot(configurationDescriptor.getLogicalFolders(),
 next.getFileObject(), false, Folder.Kind.SOURCE_DISK_FOLDER, null);
+                                
configurationDescriptor.addFilesFromRoot(configurationDescriptor.getLogicalFolders(),
 next.getFileObject(), handle, false, Folder.Kind.SOURCE_DISK_FOLDER, null);
                             }
                             handle.finish();
+                            waitSources.countDown();
                         }
                     });
+                } else {
+                    waitSources.countDown();
                 }
                 if (configurationDescriptor.getActiveConfiguration() != 
null) {
                     if (runConfigure && configurePath != null && 
configurePath.length() > 0 &&
@@ -1039,8 +1043,9 @@
         // Make sure that descriptor was stored and readed
         ConfigurationDescriptorProvider provider = 
makeProject.getLookup().lookup(ConfigurationDescriptorProvider.class);
         provider.getConfigurationDescriptor(true);
-        if (initSourceRootTask != null) {
-            initSourceRootTask.waitFinished();
+        try {
+            waitSources.await();
+        } catch (InterruptedException ex) {
         }
     }
 
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/Bundle.properties
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/Bundle.properties
copy from 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/Bundle.properties
copy to 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/Bundle.properties
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/projectimport/Bundle.properties
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/Bundle.properties
@@ -34,57 +34,4 @@
 # Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 # Microsystems, Inc. All Rights Reserved.
 
-ConfigureActionName=Configure
-
-Dialog_Title=Status of Project Creation
-Dialog_Action=details
-Configure_Success=Configuring project for code assistance was successful.
-Configure_Info=Configuring project for code assistance was partly done.
-Configure_Fail=Configuring project for code assistance failed.
-
-ProjectCreatedText=Creating project was successful.
-ProjectCreatedFailedText=Creating project failed.
-ConfigureDoneText=Running configure scrip was successful.
-ConfigureFailedText=Running configure scrip failed.
-MakeCleanText=Running make clean was successful.
-MakeCleanFailedText=Running make clean failed.
-MakeText=Running make was successful.
-MakeFailedText=Running make failed.
-CodeAssistanceText=Configuring project for code assistance was successful.
-CodeAssistanceInfoText=Configuring project for code assistance was partly 
done.
-CodeAssistanceFailedText=Configuring project for code assistance failed.
-FollowUp.details.text=Details:
-Details.String =<b>{0}</b> out of <b>{1}</b> source files have limited code 
assistance\
-<br><b>{2}</b> out of <b>{3}</b> header files have limited code assistance
-
-CTL_ReconfigureAction=Reconfigure Project...
-CFLAGS_LABEL=&C Compiler Options:
-CXXFLAGS_LABEL=C++ Com&piler Options:
-LDFLAGS_LABEL=&Linker  Options:
-ReconfigurePanel.OtherOptions.text=Con&figure Options:
-ReconfigurePanel.cFlags.text=
-ReconfigurePanel.cppFlags.text=
-ReconfigurePanel.linkerFlags.text=
-
-ReconfigureDialogTitle=Reconfigure Project
-ReconfigureButton=Reconfigure
-ReconfigureButtonAD=Starts configure, clean and build
-
-ReconfigureDescription={1} When you reconfigure a project with existing 
sources, \
- the project`s scripts are run again to create a suitable makefile \
- for the build environment and selected tool collection. A clean \
- build of the project is then performed. You should configure code \
- assistance again after reconfiguring the project. \
- <p>Enter any desired options for the compiler and linker commands \
- for the <b>{0}</b> Tool Collection before clicking Reconfigure.

-ReconfigureLegend=Project is currently configured for compilers <b>{0}</b> 
and <b>{1}</b> with \
- C options <b>{2}</b>, C++ options <b>{3}</b> and linker options 
<b>{4}</b>.<p>
-ReconfigurePanel.configureOptions.text=
-
-ImportExecutable.Progress=Analyze binary...
-ImportExecutable.Progress.ProjectCreating=Creating Project...
-ImportProject.Progress.AnalyzeRoot=Analyze source root...
-
-MAKE_LABEL={0} (Make)
-MAKE_REMOTE_LABEL={0} (Make) - {1}
+UpdateCodeAssistance=Update Code Assistance
\ No newline at end of file
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/DiscoveryProjectGeneratorImpl.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/DiscoveryProjectGeneratorImpl.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/DiscoveryProjectGeneratorImpl.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/wizard/support/impl/DiscoveryProjectGeneratorImpl.java
@@ -56,6 +56,8 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.progress.ProgressHandleFactory;
 import org.netbeans.api.project.Project;
 import org.netbeans.modules.cnd.discovery.api.ItemProperties;
 import org.netbeans.modules.cnd.discovery.api.ItemProperties.LanguageKind;
@@ -79,6 +81,7 @@
 import org.netbeans.modules.cnd.utils.CndPathUtilitities;
 import org.netbeans.modules.cnd.utils.MIMENames;
 import org.openide.filesystems.FileObject;
+import org.openide.util.NbBundle;
 import org.openide.util.Utilities;
 
 /**
@@ -628,12 +631,18 @@
     }
     
     public Set<Project> makeProject(){
-        if (projectBridge.isValid() && wizard.getConfigurations() != null && 
wizard.getConfigurations().size() > 0) {
-            projectBridge.startModifications();
-            process();
-            return projectBridge.getResult();
+        ProgressHandle handle = 
ProgressHandleFactory.createHandle(NbBundle.getMessage(DiscoveryProjectGeneratorImpl.class,
 "UpdateCodeAssistance"));
+        handle.start();
+        try {
+            if (projectBridge.isValid() && wizard.getConfigurations() != 
null && wizard.getConfigurations().size() > 0) {
+                projectBridge.startModifications();
+                process();
+                return projectBridge.getResult();
+            }
+            return Collections.<Project>emptySet();
+        } finally {
+            handle.finish();
         }
-        return Collections.<Project>emptySet();
     }
 
     private Set<String> getSourceFolders(){
diff --git a/cnd.makeproject/nbproject/project.properties 
b/cnd.makeproject/nbproject/project.properties
--- a/cnd.makeproject/nbproject/project.properties
+++ b/cnd.makeproject/nbproject/project.properties
@@ -3,7 +3,7 @@
 
 
sigtest.mail=
 
-spec.version.base=2.35
+spec.version.base=2.36
 
 test.config.stableBTD.includes=**/*Test.class
 test.config.stableBTD.excludes=\
diff --git 
a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java
 
b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java
--- 
a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java
+++ 
b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java
@@ -220,7 +220,7 @@
         @Override
         public void run() {
             for (SourceFolderInfo folderInfo : foldersToAdd) {
-                confDescriptor.addFilesFromRoot(targetFolder, 
folderInfo.getFileObject(), false, Folder.Kind.SOURCE_LOGICAL_FOLDER, 
fileFilter);
+                confDescriptor.addFilesFromRoot(targetFolder, 
folderInfo.getFileObject(), null, false, Folder.Kind.SOURCE_LOGICAL_FOLDER, 
fileFilter);
             }
         }
     }
diff --git 
a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java
 
b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java
--- 
a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java
+++ 
b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java
@@ -50,7 +50,6 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -387,7 +386,7 @@
         if (sourceFileFolders != null) {
             while (sourceFileFolders.hasNext()) {
                 SourceFolderInfo sourceFolderInfo = sourceFileFolders.next();
-                addFilesFromRoot(getLogicalFolders(), 
sourceFolderInfo.getFileObject(), false, Folder.Kind.SOURCE_DISK_FOLDER, 
null);
+                addFilesFromRoot(getLogicalFolders(), 
sourceFolderInfo.getFileObject(), null, false, 
Folder.Kind.SOURCE_DISK_FOLDER, null);
             }
         }
         setModified();
@@ -1636,7 +1635,7 @@
             if (toBeAdded.size() > 0) {
                 for (String root : toBeAdded) {
                     FileObject fo = RemoteFileUtil.getFileObject(baseDirFO, 
root);
-                    addFilesFromRoot(getLogicalFolders(), fo, true, 
Folder.Kind.SOURCE_DISK_FOLDER, null);
+                    addFilesFromRoot(getLogicalFolders(), fo, null, true, 
Folder.Kind.SOURCE_DISK_FOLDER, null);
                 }
                 setModified();
             }
@@ -1792,7 +1791,8 @@
         }
     }
 
-    public void addFilesFromRoot(Folder folder, FileObject dir, boolean 
attachListeners, Folder.Kind folderKind, @NullAllowed FileObjectFilter 
fileFilter) {
+    public void addFilesFromRoot(Folder folder, FileObject dir, 
ProgressHandle handle,
+            boolean attachListeners, Folder.Kind folderKind, @NullAllowed 
FileObjectFilter fileFilter) {
         CndUtils.assertTrueInConsole(folder != null, "null folder"); //NOI18N
         CndUtils.assertTrueInConsole(dir != null, "null directory"); //NOI18N
         if (folder == null || dir == null || !dir.isValid()) {
@@ -1814,7 +1814,7 @@
             srcRoot = folder.addFolder(srcRoot, true);
         }
         assert srcRoot.getKind() == folderKind;
-        addFilesImpl(new LinkedList<String>(), srcRoot, dir, null, 
filesAdded, true, true, fileFilter, true/*all found are included by 
default*/);
+        addFilesImpl(srcRoot, dir, handle, filesAdded, true, true, 
fileFilter, true/*all found are included by default*/);
         if (getNativeProjectChangeSupport() != null) { // once not null, it 
never becomes null
             getNativeProjectChangeSupport().fireFilesAdded(filesAdded);
         }
@@ -1826,21 +1826,23 @@
     }
 
     public Folder addFilesFromRefreshedDir(Folder folder, FileObject dir, 
boolean attachListeners, boolean setModified, @NullAllowed FileObjectFilter 
fileFilter, boolean useOldSchemeBehavior) {
-        return addFilesFromDirImpl(folder, dir, attachListeners, 
setModified, fileFilter, useOldSchemeBehavior);
+        return addFilesFromDirImpl(folder, dir, null, attachListeners, 
setModified, fileFilter, useOldSchemeBehavior);
     }
 
     public Folder addFilesFromDir(Folder folder, FileObject dir, boolean 
attachListeners, boolean setModified, @NullAllowed FileObjectFilter 
fileFilter) {
-        return addFilesFromDirImpl(folder, dir, attachListeners, 
setModified, fileFilter, false);
+        return addFilesFromDirImpl(folder, dir, null, attachListeners, 
setModified, fileFilter, false);
     }
     
-    private Folder addFilesFromDirImpl(Folder folder, FileObject dir, 
boolean attachListeners, boolean setModified, @NullAllowed FileObjectFilter 
fileFilter, boolean useOldSchemeBehavior) {
+    private Folder addFilesFromDirImpl(Folder folder, FileObject dir, 
ProgressHandle handle,
+            boolean attachListeners, boolean setModified, @NullAllowed
+            FileObjectFilter fileFilter, boolean useOldSchemeBehavior) {
         ArrayList<NativeFileItem> filesAdded = new 
ArrayList<NativeFileItem>();
         Folder subFolder = folder.findFolderByName(dir.getNameExt());
         if (subFolder == null) {
             subFolder = new Folder(folder.getConfigurationDescriptor(), 
folder, dir.getNameExt(), dir.getNameExt(), true, null);
         }
         subFolder = folder.addFolder(subFolder, setModified);
-        addFilesImpl(new LinkedList<String>(), subFolder, dir, null, 
filesAdded, true, setModified, fileFilter, useOldSchemeBehavior);
+        addFilesImpl(subFolder, dir, null, filesAdded, true, setModified, 
fileFilter, useOldSchemeBehavior);
         if (getNativeProjectChangeSupport() != null) { // once not null, it 
never becomes null
             getNativeProjectChangeSupport().fireFilesAdded(filesAdded);
         }
@@ -1850,96 +1852,105 @@
         return subFolder;
     }
 
-    private void addFilesImpl(LinkedList<String> antiLoop, Folder folder, 
FileObject dir, ProgressHandle handle, ArrayList<NativeFileItem> filesAdded, 
boolean notify, boolean setModified, @NullAllowed
-        final FileObjectFilter fileFilter, boolean useOldSchemeBehavior) {
+    private void addFilesImpl(final Folder aFolder, final FileObject aDir, 
final ProgressHandle handle, 
+            final ArrayList<NativeFileItem> filesAdded, final boolean 
notify, final boolean setModified,
+            @NullAllowed final FileObjectFilter fileFilter, final boolean 
useOldSchemeBehavior) {
         List<String> absTestRootsList = getAbsoluteTestRoots();
+        List<AntiLoop> down = new ArrayList<AntiLoop>();
+        String canPath;
         try {
-            String canPath = RemoteFileUtil.getCanonicalPath(dir);
-            if (antiLoop.contains(canPath)) {
-                // It seems we have recursive link
-                LOGGER.log(Level.INFO, "Ignore recursive link {0} in folder 
{1}", new Object[]{canPath, folder.getPath()});
-                return;
-            }
-            antiLoop.addLast(canPath);
+            canPath = RemoteFileUtil.getCanonicalPath(aDir);
         } catch (IOException ex) {
-            LOGGER.log(Level.INFO, ex.getMessage(), ex);
             return;
         }
-
-        PerformanceLogger.PerformaceAction lsPerformanceEvent = 
PerformanceLogger.getLogger().start(Folder.LS_FOLDER_PERFORMANCE_EVENT, dir);
-        FileObject[] files = null;
-        try {
-            lsPerformanceEvent.setTimeOut(Folder.FS_TIME_OUT);
-            files = dir.getChildren();
-            if (files == null) {
-                antiLoop.removeLast();
-                return;
-            }
-        } finally {
-            lsPerformanceEvent.log(files== null ? 0 : files.length);
-        }
-
-        final boolean hideBinaryFiles = 
!MakeOptions.getInstance().getViewBinaryFiles();
-        for (FileObject file : files) {
-            if (!VisibilityQuery.getDefault().isVisible(file)) {
-                continue;
-            }
-            if (fileFilter != null && !fileFilter.accept(file)) {
-                continue;
-            }
-            if (hideBinaryFiles && 
CndFileVisibilityQuery.getDefault().isIgnored(file.getNameExt())) {
-                continue;
-            }
-            if (file.isData() && folder.isDiskFolder() && 
!CndFileVisibilityQuery.getDefault().isVisible(file)) {
-                // be consistent in checks to prevent adding item here 
followed
-                // by remove in Folder.refreshDiskFolder due to 
!CndFileVisibilityQuery.getDefault().isIgnored(file)
-                continue;
-            }
-            if (file.isFolder() && 
getFolderVisibilityQuery().isIgnored(file)) {
-                continue;
-            }
-            if (file.isFolder()) {
+        AntiLoop antiLoop = new AntiLoop(aFolder, aDir, null);
+        antiLoop.push(canPath);
+        down.add(antiLoop);
+        while (!down.isEmpty()) {
+            List<AntiLoop> next = new ArrayList<AntiLoop>();
+            for (AntiLoop loop : down) {
+                FileObject dir = loop.getFile();
+                Folder folder = loop.getFolder();
+                if (handle != null) {
+                    handle.progress("("+filesAdded.size()+") 
"+dir.getPath()); //NOI18N
+                }
+                PerformanceLogger.PerformaceAction lsPerformanceEvent = 
PerformanceLogger.getLogger().start(Folder.LS_FOLDER_PERFORMANCE_EVENT, dir);
+                FileObject[] files = null;
                 try {
-                    String canPath = RemoteFileUtil.getCanonicalPath(file);
-                    if (antiLoop.contains(canPath)) {
-                        // It seems we have recursive link
-                        LOGGER.log(Level.INFO, "Ignore recursive link {0} in 
folder {1}", new Object[]{canPath, folder.getPath()});
+                    lsPerformanceEvent.setTimeOut(Folder.FS_TIME_OUT);
+                    files = dir.getChildren();
+                    if (files == null) {
                         continue;
                     }
-                } catch (IOException ex) {
-                    LOGGER.log(Level.INFO, ex.getMessage(), ex);
-                    continue;
+                } finally {
+                    lsPerformanceEvent.log(files == null ? 0 : files.length);
                 }
-                Folder dirfolder = 
folder.findFolderByName(file.getNameExt());
-                if (dirfolder == null) {
-                    // child folder inherits kind of parent folder
-                    if (inList(absTestRootsList, 
RemoteFileUtil.getAbsolutePath(file)) || folder.isTestLogicalFolder()) {
-                        dirfolder = folder.addNewFolder(file.getNameExt(), 
file.getNameExt(), true, Folder.Kind.TEST_LOGICAL_FOLDER);
+
+                final boolean hideBinaryFiles = 
!MakeOptions.getInstance().getViewBinaryFiles();
+                for (FileObject file : files) {
+                    if (!VisibilityQuery.getDefault().isVisible(file)) {
+                        continue;
+                    }
+                    if (fileFilter != null && !fileFilter.accept(file)) {
+                        continue;
+                    }
+                    if (hideBinaryFiles && 
CndFileVisibilityQuery.getDefault().isIgnored(file.getNameExt())) {
+                        continue;
+                    }
+                    if (file.isData() && folder.isDiskFolder() && 
!CndFileVisibilityQuery.getDefault().isVisible(file)) {
+                        // be consistent in checks to prevent adding item 
here followed
+                        // by remove in Folder.refreshDiskFolder due to 
!CndFileVisibilityQuery.getDefault().isIgnored(file)
+                        continue;
+                    }
+                    if (file.isFolder() && 
getFolderVisibilityQuery().isIgnored(file)) {
+                        continue;
+                    }
+                    if (handle != null) {
+                        handle.progress("("+filesAdded.size()+") 
"+file.getPath()); //NOI18N
+                    }
+                    if (file.isFolder()) {
+                        try {
+                            canPath = RemoteFileUtil.getCanonicalPath(file);
+                            if (loop.contains(canPath)) {
+                                // It seems we have recursive link
+                                LOGGER.log(Level.INFO, "Ignore recursive 
link {0} in folder {1}", new Object[]{canPath, folder.getPath()});
+                                continue;
+                            }
+                        } catch (IOException ex) {
+                            LOGGER.log(Level.INFO, ex.getMessage(), ex);
+                            continue;
+                        }
+                        Folder dirfolder = 
folder.findFolderByName(file.getNameExt());
+                        if (dirfolder == null) {
+                            // child folder inherits kind of parent folder
+                            if (inList(absTestRootsList, 
RemoteFileUtil.getAbsolutePath(file)) || folder.isTestLogicalFolder()) {
+                                dirfolder = 
folder.addNewFolder(file.getNameExt(), file.getNameExt(), true, 
Folder.Kind.TEST_LOGICAL_FOLDER);
+                            } else {
+                                dirfolder = 
folder.addNewFolder(file.getNameExt(), file.getNameExt(), true, (Folder.Kind) 
null);
+                            }
+                        }
+                        dirfolder.markRemoved(false);
+                        antiLoop = new AntiLoop(dirfolder, file, loop);
+                        antiLoop.push(canPath);
+                        next.add(antiLoop);
                     } else {
-                        dirfolder = folder.addNewFolder(file.getNameExt(), 
file.getNameExt(), true, (Folder.Kind)null);
+                        PerformanceLogger.PerformaceAction performanceEvent 
= PerformanceLogger.getLogger().start(Folder.CREATE_ITEM_PERFORMANCE_EVENT, 
file);
+                        Item item = null;
+                        try {
+                            performanceEvent.setTimeOut(Folder.FS_TIME_OUT);
+                            String path = 
ProjectSupport.toProperPath(baseDirFO, file, project);
+                            item = Item.createInBaseDir(baseDirFO, path);
+                            if (folder.addItemFromRefreshDir(item, notify, 
setModified, useOldSchemeBehavior) == item) {
+                                filesAdded.add(item);
+                            }
+                        } finally {
+                            performanceEvent.log(item);
+                        }
                     }
                 }
-                dirfolder.markRemoved(false);
-                addFilesImpl(antiLoop, dirfolder, file, handle, filesAdded, 
notify, setModified, fileFilter, useOldSchemeBehavior);
-            } else {
-                PerformanceLogger.PerformaceAction performanceEvent = 
PerformanceLogger.getLogger().start(Folder.CREATE_ITEM_PERFORMANCE_EVENT, 
file);
-                Item item = null;
-                try {
-                    performanceEvent.setTimeOut(Folder.FS_TIME_OUT);
-                    String path = ProjectSupport.toProperPath(baseDirFO, 
file, project);
-                    item = Item.createInBaseDir(baseDirFO, path);
-                    if (folder.addItemFromRefreshDir(item, notify, 
setModified, useOldSchemeBehavior) == item) {
-                        filesAdded.add(item);
-                    }
-                } finally {
-                    performanceEvent.log(item);
-                }
-                if (handle != null) {
-                    handle.progress(item.getPath());
-                }
             }
+            down = next;
         }
-        antiLoop.removeLast();
     }
 
     public boolean okToChange() {
@@ -1982,4 +1993,29 @@
     private static String getString(String s, String a1) {
         return NbBundle.getMessage(MakeConfigurationDescriptor.class, s, a1);
     }
+    
+    static class AntiLoop {
+        private final Folder currentFolder;
+        private final FileObject currentFile;
+        private final List<String> antiLoop = new ArrayList<String>();
+        AntiLoop(Folder folder, FileObject file, AntiLoop prev){
+            if (prev != null) {
+                antiLoop.addAll(prev.antiLoop);
+            }
+            this.currentFolder = folder;
+            this.currentFile = file;
+        }
+        boolean contains(String canonicalPath) {
+            return antiLoop.contains(canonicalPath);
+        }
+        void push(String canonicalPath) {
+            antiLoop.add(canonicalPath);
+        }
+        Folder getFolder() {
+            return currentFolder;
+        }
+        FileObject getFile() {
+            return currentFile;
+        }
+    }
 }
diff --git a/cnd.remote.projectui/nbproject/project.xml 
b/cnd.remote.projectui/nbproject/project.xml
--- a/cnd.remote.projectui/nbproject/project.xml
+++ b/cnd.remote.projectui/nbproject/project.xml
@@ -72,7 +72,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>2</release-version>
-                        <specification-version>2.8.4</specification-version>
+                        <specification-version>2.36</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/Bundle.properties
 
b/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/Bundle.properties
--- 
a/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/Bundle.properties
+++ 
b/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/Bundle.properties
@@ -94,3 +94,5 @@
 ERROR_RUN_PROJECT_CREATOR=Cannot run Oracle Solaris Studio 12.3 or later on 
host {0}.
 RUN_PROJECT_CREATOR=Creating project on host {0}...
 CONFIGURING_PROJECT_CREATOR=Configuring project on host {0}...
+
+ImportProject.Progress.AnalyzeRoot=Analyze source root...
diff --git 
a/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/ImportRemoteProject.java
 
b/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/ImportRemoteProject.java
--- 
a/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/ImportRemoteProject.java
+++ 
b/cnd.remote.projectui/src/org/netbeans/modules/cnd/remote/projectui/wizard/cnd/ImportRemoteProject.java
@@ -52,6 +52,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.EnumMap;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -62,6 +63,7 @@
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -99,6 +101,7 @@
 import org.netbeans.modules.cnd.makeproject.api.ProjectSupport;
 import org.netbeans.modules.cnd.makeproject.api.SourceFolderInfo;
 import 
org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider;
+import org.netbeans.modules.cnd.makeproject.api.configurations.Folder;
 import 
org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration;
 import 
org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
 import org.netbeans.modules.cnd.makeproject.api.wizards.IteratorExtension;
@@ -185,6 +188,7 @@
     private static final String CND_TOOLS_VALUE = 
System.getProperty("cnd.buildtrace.tools", 
"gcc:c++:g++:gfortran:g77:g90:g95:cc:CC:ffortran:f77:f90:f95"); //NOI18N
     private static final String CND_BUILD_LOG = "__CND_BUILD_LOG__"; //NOI18N
     private boolean useBuildTrace = true;
+    private final CountDownLatch waitSources = new CountDownLatch(1);
 
 
     public ImportRemoteProject(WizardDescriptor wizard) {
@@ -349,7 +353,8 @@
         ProjectGenerator.ProjectParameters prjParams = new 
ProjectGenerator.ProjectParameters(projectName, projectFolder);
         prjParams
                 .setConfiguration(extConf)
-                .setSourceFolders(sources)
+                
.setSourceFolders(Collections.<SourceFolderInfo>emptyList().iterator())
+                //.setSourceFolders(sources)
                 .setSourceFoldersFilter(sourceFoldersFilter)
                 .setTestFolders(tests)
                 .setImportantFiles(importantItemsIterator)
@@ -413,6 +418,24 @@
             ConfigurationDescriptorProvider pdp = 
makeProject.getLookup().lookup(ConfigurationDescriptorProvider.class);
             pdp.getConfigurationDescriptor();
             if (pdp.gotDescriptor()) {
+                final MakeConfigurationDescriptor configurationDescriptor = 
pdp.getConfigurationDescriptor();
+                if (sources != null) {
+                    RP.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            ProgressHandle handle = 
ProgressHandleFactory.createHandle(NbBundle.getMessage(ImportRemoteProject.class,
 "ImportProject.Progress.AnalyzeRoot"));
+                            handle.start();
+                            while(sources.hasNext()) {
+                                SourceFolderInfo next = sources.next();
+                                
configurationDescriptor.addFilesFromRoot(configurationDescriptor.getLogicalFolders(),
 next.getFileObject(), handle, false, Folder.Kind.SOURCE_DISK_FOLDER, null);
+                            }
+                            handle.finish();
+                            waitSources.countDown();
+                        }
+                    });
+                } else {
+                    waitSources.countDown();
+                }
                 if 
(pdp.getConfigurationDescriptor().getActiveConfiguration() != null) {
                     if (runConfigure && configurePath != null && 
configurePath.length() > 0 &&
                             configureFileObject != null && 
configureFileObject.isValid()) {
@@ -872,6 +895,10 @@
         // Make sure that descriptor was stored and readed
         ConfigurationDescriptorProvider provider = 
makeProject.getLookup().lookup(ConfigurationDescriptorProvider.class);
         provider.getConfigurationDescriptor(true);
+        try {
+            waitSources.await();
+        } catch (InterruptedException ex) {
+        }
     }
 
     private void discovery(int rc, String makeLog, File execLog) {

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/01/2013

<Possible follow-up(s)>

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/01/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/04/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/06/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/07/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/07/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/08/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/08/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/12/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/15/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/19/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/21/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/21/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/25/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/25/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/26/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/26/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/27/2013

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 186 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close