From 4642a81450fab0116350b2d2ea3ebee7e24d6061 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Mon, 25 Apr 2016 18:50:52 +0300 Subject: [PATCH] IDEA-149447 Eternal 'You can configure Gradle wrapper...' --- ...DistributionWithSourcesNotificationProvider.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/codeInsight/UseDistributionWithSourcesNotificationProvider.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/codeInsight/UseDistributionWithSourcesNotificationProvider.java index db49112ba273..3a16c189eb6d 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/codeInsight/UseDistributionWithSourcesNotificationProvider.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/codeInsight/UseDistributionWithSourcesNotificationProvider.java @@ -49,6 +49,7 @@ import org.jetbrains.plugins.gradle.util.GradleUtil; import java.io.File; import java.net.URI; +import java.net.URISyntaxException; import java.util.Collections; import java.util.Properties; import java.util.regex.Pattern; @@ -98,7 +99,7 @@ public class UseDistributionWithSourcesNotificationProvider extends EditorNotifi final GradleProjectSettings settings = GradleSettings.getInstance(module.getProject()).getLinkedProjectSettings(rootProjectPath); if (settings == null || settings.getDistributionType() != DistributionType.DEFAULT_WRAPPED) return null; if (settings.isDisableWrapperSourceDistributionNotification()) return null; - if (isWrapperDistributionWithSourcesUsed(rootProjectPath)) return null; + if (!showUseDistributionWithSourcesTip(rootProjectPath)) return null; final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText(GradleBundle.message("gradle.notifications.use.distribution.with.sources")); @@ -157,12 +158,18 @@ public class UseDistributionWithSourcesNotificationProvider extends EditorNotifi } } - private static boolean isWrapperDistributionWithSourcesUsed(String linkedProjectPath) { + private static boolean showUseDistributionWithSourcesTip(String linkedProjectPath) { WrapperConfiguration wrapperConfiguration = GradleUtil.getWrapperConfiguration(linkedProjectPath); // currently only wrapped distribution takes into account if (wrapperConfiguration == null) return true; String distributionUri = wrapperConfiguration.getDistribution().toString(); - return GRADLE_SRC_DISTRIBUTION_PATTERN.matcher(distributionUri).matches(); + try { + String host = new URI(distributionUri).getHost(); + return host.endsWith("gradle.org") && !GRADLE_SRC_DISTRIBUTION_PATTERN.matcher(distributionUri).matches(); + } + catch (URISyntaxException ignore) { + } + return false; } @Nullable