Search in sources :

Example 1 with DetectionExcludesConfigurationImpl

use of com.intellij.framework.detection.impl.exclude.DetectionExcludesConfigurationImpl in project intellij-community by JetBrains.

the class FrameworkDetectionManager method runDetector.

private List<? extends DetectedFrameworkDescription> runDetector(Integer detectorId, FileBasedIndex index, DetectionExcludesConfiguration excludesConfiguration, final boolean processNewFilesOnly) {
    Collection<VirtualFile> acceptedFiles = index.getContainingFiles(FrameworkDetectionIndex.NAME, detectorId, GlobalSearchScope.projectScope(myProject));
    final Collection<VirtualFile> filesToProcess;
    if (processNewFilesOnly) {
        filesToProcess = myDetectedFrameworksData.retainNewFiles(detectorId, acceptedFiles);
    } else {
        filesToProcess = new ArrayList<>(acceptedFiles);
    }
    FrameworkDetector detector = FrameworkDetectorRegistry.getInstance().getDetectorById(detectorId);
    if (detector == null) {
        LOG.info("Framework detector not found by id " + detectorId);
        return Collections.emptyList();
    }
    ((DetectionExcludesConfigurationImpl) excludesConfiguration).removeExcluded(filesToProcess, detector.getFrameworkType());
    if (LOG.isDebugEnabled()) {
        LOG.debug("Detector '" + detector.getDetectorId() + "': " + acceptedFiles.size() + " accepted files, " + filesToProcess.size() + " files to process");
    }
    final List<? extends DetectedFrameworkDescription> frameworks;
    if (!filesToProcess.isEmpty()) {
        frameworks = detector.detect(filesToProcess, new FrameworkDetectionContextImpl(myProject));
    } else {
        frameworks = Collections.emptyList();
    }
    return frameworks;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FrameworkDetector(com.intellij.framework.detection.FrameworkDetector) DetectionExcludesConfigurationImpl(com.intellij.framework.detection.impl.exclude.DetectionExcludesConfigurationImpl)

Aggregations

FrameworkDetector (com.intellij.framework.detection.FrameworkDetector)1 DetectionExcludesConfigurationImpl (com.intellij.framework.detection.impl.exclude.DetectionExcludesConfigurationImpl)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1