From e12024672fb01f3b327c4a630ab4c9961e9300ef Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 9 Aug 2022 17:06:27 +0300 Subject: [PATCH 1/2] Deprecated API usages in the plugin should be replaced with stable API calls #693 Get rid of Module.getModuleFile() --- .../kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt index 4867cd72f6..2bf1fd5eca 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.module.Module import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.module.ModuleUtilCore import com.intellij.openapi.project.Project +import com.intellij.openapi.project.guessModuleDir import com.intellij.openapi.projectRoots.JavaSdk import com.intellij.openapi.projectRoots.JavaSdkVersion import com.intellij.openapi.projectRoots.Sdk @@ -159,8 +160,8 @@ fun Module.addDedicatedTestRoot(testSourceRoots: MutableList): Virt val moduleInstance = ModuleRootManager.getInstance(this) val testFolder = moduleInstance.contentEntries.flatMap { it.sourceFolders.toList() } .firstOrNull { it.rootType in testSourceRootTypes } - (testFolder?.let { testFolder.file?.parent } ?: (testFolder?.contentEntry - ?: moduleInstance.contentEntries.first()).file ?: moduleFile)?.let { + (testFolder?.let { testFolder.file?.parent } + ?: testFolder?.contentEntry?.file ?: this.guessModuleDir())?.let { val file = FakeVirtualFile(it, dedicatedTestSourceRootName) testSourceRoots.add(file) // We return "true" IFF it's case of not yet created fake directory From ff6c5c031fe8f2584c04adf2d467979d2c891a8c Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 20 Sep 2022 16:53:55 +0300 Subject: [PATCH 2/2] Deprecated API usages in the plugin should be replaced with stable API calls #693 --- .../kotlin/org/utbot/intellij/plugin/ui/Notifications.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/Notifications.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/Notifications.kt index 0c916c0239..7b9a3d6705 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/Notifications.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/Notifications.kt @@ -83,13 +83,8 @@ abstract class UrlNotifier : Notifier() { protected abstract val urlOpeningListener: NotificationListener override fun notify(info: String, project: Project?, module: Module?) { - notificationGroup - .createNotification( - titleText, - content(project, module, info), - notificationType, - urlOpeningListener, - ).notify(project) + notificationGroup.createNotification(content(project, module, info), notificationType) + .setTitle(titleText).setListener(urlOpeningListener).notify(project) } }