From eb5345ba44cdac1c957c9000630c73ce7e8bb44f Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 25 Nov 2011 16:10:13 +0400 Subject: [PATCH] fixed detection for already added facets (EA-26990, EA-31952) [rev. by Dmitry A.] --- .../impl/DetectedFrameworksData.java | 6 ++--- .../impl/FrameworkDetectionManager.java | 26 +++---------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java index 8b30d085f14b..7816cf9469bc 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java @@ -40,13 +40,11 @@ import java.util.*; */ public class DetectedFrameworksData { private static final Logger LOG = Logger.getInstance("#com.intellij.framework.detection.impl.DetectedFrameworksData"); - private final Project myProject; private PersistentHashMap myExistentFrameworkFiles; private TIntObjectHashMap myNewFiles; private MultiMap myDetectedFrameworks; public DetectedFrameworksData(Project project) { - myProject = project; myDetectedFrameworks = new MultiMap(); File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() + File.separator + "files"); @@ -105,8 +103,8 @@ public class DetectedFrameworksData { return newFiles; } - public MultiMap getDetectedFrameworks() { - return myDetectedFrameworks; + public Set getDetectorsForDetectedFrameworks() { + return myDetectedFrameworks.keySet(); } public Collection updateFrameworksList(Integer detectorId, diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionManager.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionManager.java index d165422d65dd..b4d34918eed4 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionManager.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionManager.java @@ -44,7 +44,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.util.containers.MultiMap; import com.intellij.util.indexing.FileBasedIndex; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; @@ -264,31 +263,12 @@ public class FrameworkDetectionManager extends AbstractProjectComponent implemen } private List getValidDetectedFrameworks() { - final MultiMap frameworksMap = myDetectedFrameworksData.getDetectedFrameworks(); + final Set detectors = myDetectedFrameworksData.getDetectorsForDetectedFrameworks(); List descriptions = new ArrayList(); final FileBasedIndex index = FileBasedIndex.getInstance(); final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(myProject); - for (Integer id : frameworksMap.keySet()) { - final Collection acceptedFiles = index.getContainingFiles(FrameworkDetectionIndex.NAME, id, - GlobalSearchScope.projectScope(myProject)); - boolean obsolete = false; - for (DetectedFrameworkDescription description : frameworksMap.get(id)) { - if (!acceptedFiles.containsAll(description.getRelatedFiles())) { - if (LOG.isDebugEnabled()) { - LOG.debug("Some files from " + description.getRelatedFiles() + " aren't accepted by detector any more (accepted = " + acceptedFiles + ")"); - } - obsolete = true; - break; - } - } - final Collection frameworks; - if (obsolete) { - frameworks = runDetector(id, index, excludesConfiguration, false); - } - else { - frameworks = frameworksMap.get(id); - } - + for (Integer id : detectors) { + final Collection frameworks = runDetector(id, index, excludesConfiguration, false); for (DetectedFrameworkDescription framework : frameworks) { descriptions.add(framework); }