mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed detection for already added facets (EA-26990, EA-31952) [rev. by Dmitry A.]
This commit is contained in:
+2
-4
@@ -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<Integer,TIntHashSet> myExistentFrameworkFiles;
|
||||
private TIntObjectHashMap<TIntHashSet> myNewFiles;
|
||||
private MultiMap<Integer, DetectedFrameworkDescription> myDetectedFrameworks;
|
||||
|
||||
public DetectedFrameworksData(Project project) {
|
||||
myProject = project;
|
||||
myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>();
|
||||
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<Integer, DetectedFrameworkDescription> getDetectedFrameworks() {
|
||||
return myDetectedFrameworks;
|
||||
public Set<Integer> getDetectorsForDetectedFrameworks() {
|
||||
return myDetectedFrameworks.keySet();
|
||||
}
|
||||
|
||||
public Collection<? extends DetectedFrameworkDescription> updateFrameworksList(Integer detectorId,
|
||||
|
||||
+3
-23
@@ -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<? extends DetectedFrameworkDescription> getValidDetectedFrameworks() {
|
||||
final MultiMap<Integer,DetectedFrameworkDescription> frameworksMap = myDetectedFrameworksData.getDetectedFrameworks();
|
||||
final Set<Integer> detectors = myDetectedFrameworksData.getDetectorsForDetectedFrameworks();
|
||||
List<DetectedFrameworkDescription> descriptions = new ArrayList<DetectedFrameworkDescription>();
|
||||
final FileBasedIndex index = FileBasedIndex.getInstance();
|
||||
final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(myProject);
|
||||
for (Integer id : frameworksMap.keySet()) {
|
||||
final Collection<VirtualFile> 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<? extends DetectedFrameworkDescription> frameworks;
|
||||
if (obsolete) {
|
||||
frameworks = runDetector(id, index, excludesConfiguration, false);
|
||||
}
|
||||
else {
|
||||
frameworks = frameworksMap.get(id);
|
||||
}
|
||||
|
||||
for (Integer id : detectors) {
|
||||
final Collection<? extends DetectedFrameworkDescription> frameworks = runDetector(id, index, excludesConfiguration, false);
|
||||
for (DetectedFrameworkDescription framework : frameworks) {
|
||||
descriptions.add(framework);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user