Search in sources :

Example 1 with DetectionExcludesConfiguration

use of com.intellij.framework.detection.DetectionExcludesConfiguration in project intellij-community by JetBrains.

the class FacetImporter method isFacetDetectionDisabled.

protected boolean isFacetDetectionDisabled(Project project) {
    final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(project);
    final FrameworkType frameworkType = FrameworkDetectionUtil.findFrameworkTypeForFacetDetector(myFacetType);
    if (frameworkType == null)
        return false;
    return excludesConfiguration.isExcludedFromDetection(frameworkType);
}
Also used : FrameworkType(com.intellij.framework.FrameworkType) DetectionExcludesConfiguration(com.intellij.framework.detection.DetectionExcludesConfiguration)

Example 2 with DetectionExcludesConfiguration

use of com.intellij.framework.detection.DetectionExcludesConfiguration in project intellij-community by JetBrains.

the class FrameworkDetectionManager method doRunDetection.

private void doRunDetection() {
    Set<Integer> detectorsToProcess;
    synchronized (myLock) {
        detectorsToProcess = new HashSet<>(myDetectorsToProcess);
        detectorsToProcess.addAll(myDetectorsToProcess);
        myDetectorsToProcess.clear();
    }
    if (detectorsToProcess.isEmpty())
        return;
    if (LOG.isDebugEnabled()) {
        LOG.debug("Starting framework detectors: " + detectorsToProcess);
    }
    final FileBasedIndex index = FileBasedIndex.getInstance();
    List<DetectedFrameworkDescription> newDescriptions = new ArrayList<>();
    List<DetectedFrameworkDescription> oldDescriptions = new ArrayList<>();
    final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(myProject);
    for (Integer id : detectorsToProcess) {
        final List<? extends DetectedFrameworkDescription> frameworks = runDetector(id, index, excludesConfiguration, true);
        oldDescriptions.addAll(frameworks);
        final Collection<? extends DetectedFrameworkDescription> updated = myDetectedFrameworksData.updateFrameworksList(id, frameworks);
        newDescriptions.addAll(updated);
        oldDescriptions.removeAll(updated);
        if (LOG.isDebugEnabled()) {
            LOG.debug(frameworks.size() + " frameworks detected, " + updated.size() + " changed");
        }
    }
    Set<String> frameworkNames = new HashSet<>();
    for (final DetectedFrameworkDescription description : FrameworkDetectionUtil.removeDisabled(newDescriptions, oldDescriptions)) {
        frameworkNames.add(description.getDetector().getFrameworkType().getPresentableName());
    }
    if (!frameworkNames.isEmpty()) {
        String names = StringUtil.join(frameworkNames, ", ");
        final String text = ProjectBundle.message("framework.detected.info.text", names, frameworkNames.size());
        FRAMEWORK_DETECTION_NOTIFICATION.createNotification("Frameworks detected", text, NotificationType.INFORMATION, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                    showSetupFrameworksDialog(notification);
                }
            }
        }).notify(myProject);
    }
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) DetectedFrameworkDescription(com.intellij.framework.detection.DetectedFrameworkDescription) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) FileBasedIndex(com.intellij.util.indexing.FileBasedIndex) DetectionExcludesConfiguration(com.intellij.framework.detection.DetectionExcludesConfiguration) NotificationListener(com.intellij.notification.NotificationListener)

Example 3 with DetectionExcludesConfiguration

use of com.intellij.framework.detection.DetectionExcludesConfiguration in project intellij-community by JetBrains.

the class FacetImporter method disableFacetAutodetection.

private void disableFacetAutodetection(Module module, IdeModifiableModelsProvider provider) {
    if (!isDisableFacetAutodetection(module))
        return;
    final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(module.getProject());
    final FrameworkType frameworkType = FrameworkDetectionUtil.findFrameworkTypeForFacetDetector(myFacetType);
    if (frameworkType != null) {
        for (VirtualFile file : provider.getContentRoots(module)) {
            excludesConfiguration.addExcludedFile(file, frameworkType);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FrameworkType(com.intellij.framework.FrameworkType) DetectionExcludesConfiguration(com.intellij.framework.detection.DetectionExcludesConfiguration)

Example 4 with DetectionExcludesConfiguration

use of com.intellij.framework.detection.DetectionExcludesConfiguration in project intellij-community by JetBrains.

the class FrameworkDetectionManager method getValidDetectedFrameworks.

private List<? extends DetectedFrameworkDescription> getValidDetectedFrameworks() {
    final Set<Integer> detectors = myDetectedFrameworksData.getDetectorsForDetectedFrameworks();
    List<DetectedFrameworkDescription> descriptions = new ArrayList<>();
    final FileBasedIndex index = FileBasedIndex.getInstance();
    final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(myProject);
    for (Integer id : detectors) {
        final Collection<? extends DetectedFrameworkDescription> frameworks = runDetector(id, index, excludesConfiguration, false);
        for (DetectedFrameworkDescription framework : frameworks) {
            descriptions.add(framework);
        }
    }
    return FrameworkDetectionUtil.removeDisabled(descriptions);
}
Also used : DetectedFrameworkDescription(com.intellij.framework.detection.DetectedFrameworkDescription) FileBasedIndex(com.intellij.util.indexing.FileBasedIndex) DetectionExcludesConfiguration(com.intellij.framework.detection.DetectionExcludesConfiguration)

Aggregations

DetectionExcludesConfiguration (com.intellij.framework.detection.DetectionExcludesConfiguration)4 FrameworkType (com.intellij.framework.FrameworkType)2 DetectedFrameworkDescription (com.intellij.framework.detection.DetectedFrameworkDescription)2 FileBasedIndex (com.intellij.util.indexing.FileBasedIndex)2 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 NotNull (org.jetbrains.annotations.NotNull)1