diff --git a/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/DefaultGradleSettingsListener.java b/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/DefaultGradleSettingsListener.java new file mode 100644 index 00000000..8be35f41 --- /dev/null +++ b/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/DefaultGradleSettingsListener.java @@ -0,0 +1,27 @@ +package org.gradle.profiler.studio.plugin; + +import java.util.Collection; +import java.util.Set; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.plugins.gradle.settings.DistributionType; +import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; +import org.jetbrains.plugins.gradle.settings.GradleSettingsListener; +import org.jetbrains.plugins.gradle.settings.TestRunner; + +/** + * A default implementation of GradleSettingsListener that does nothing. + */ +public class DefaultGradleSettingsListener implements GradleSettingsListener { + @Override public void onProjectsLinked(@NotNull Collection settings) { } + @Override public void onGradleHomeChange(@Nullable String oldPath, @Nullable String newPath, @NotNull String linkedProjectPath) { } + @Override public void onGradleDistributionTypeChange(DistributionType currentValue, @NotNull String linkedProjectPath) { } + @Override public void onServiceDirectoryPathChange(@Nullable String oldPath, @Nullable String newPath) { } + @Override public void onGradleVmOptionsChange(@Nullable String oldOptions, @Nullable String newOptions) { } + @Override public void onBuildDelegationChange(boolean delegatedBuild, @NotNull String linkedProjectPath) { } + @Override public void onTestRunnerChange(@NotNull TestRunner currentTestRunner, @NotNull String linkedProjectPath) { } + @Override public void onProjectRenamed(@NotNull String oldName, @NotNull String newName) { } + @Override public void onProjectsUnlinked(@NotNull Set linkedProjectPaths) { } + @Override public void onBulkChangeStart() { } + @Override public void onBulkChangeEnd() { } +} diff --git a/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/GradleProfilerStartupActivity.java b/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/GradleProfilerStartupActivity.java index 46948f06..9c36b314 100644 --- a/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/GradleProfilerStartupActivity.java +++ b/subprojects/studio-plugin/src/main/java/org/gradle/profiler/studio/plugin/GradleProfilerStartupActivity.java @@ -5,7 +5,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager; -import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.util.registry.Registry; @@ -84,7 +83,7 @@ private void disableDownloadOfExternalAnnotations(Project project) { GradleSettings gradleSettings = GradleSettings.getInstance(project); gradleSettings.getLinkedProjectsSettings() .forEach(settings -> settings.setResolveExternalAnnotations(false)); - gradleSettings.subscribe(new ExternalSystemSettingsListenerAdapter<>() { + gradleSettings.subscribe(new DefaultGradleSettingsListener() { @Override public void onProjectsLinked(@NotNull Collection linkedProjectsSettings) { linkedProjectsSettings.forEach(settings -> settings.setResolveExternalAnnotations(false)); diff --git a/subprojects/studio-plugin/src/testFixtures/groovy/org/gradle/profiler/studio/plugin/IdeSetupHelper.groovy b/subprojects/studio-plugin/src/testFixtures/groovy/org/gradle/profiler/studio/plugin/IdeSetupHelper.groovy index 0ed227af..f93e2f6e 100644 --- a/subprojects/studio-plugin/src/testFixtures/groovy/org/gradle/profiler/studio/plugin/IdeSetupHelper.groovy +++ b/subprojects/studio-plugin/src/testFixtures/groovy/org/gradle/profiler/studio/plugin/IdeSetupHelper.groovy @@ -3,7 +3,6 @@ package org.gradle.profiler.studio.plugin import com.android.tools.idea.sdk.Jdks import com.intellij.openapi.application.WriteAction import com.intellij.openapi.externalSystem.service.execution.ExternalSystemJdkUtil -import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.projectRoots.ProjectJdkTable @@ -53,7 +52,7 @@ class IdeSetupHelper extends HeavyPlatformTestCase { ProjectRootManager.getInstance(project).setProjectSdk(jdk) } GradleSettings gradleSettings = GradleSettings.getInstance(project); - gradleSettings.subscribe(new ExternalSystemSettingsListenerAdapter() { + gradleSettings.subscribe(new DefaultGradleSettingsListener() { @Override void onProjectsLinked(@NotNull Collection linkedProjectsSettings) { linkedProjectsSettings.each { it.gradleJvm = ExternalSystemJdkUtil.USE_PROJECT_JDK }