Skip to content

Commit 4b288cf

Browse files
User's possibility to automatically increase limits on file size and … (#1510)
User's possibility to automatically increase limits on file size and tests number #1348
1 parent 9de97f8 commit 4b288cf

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
1818
import com.intellij.openapi.fileTypes.FileType
1919
import com.intellij.openapi.module.Module
2020
import com.intellij.openapi.progress.ProgressIndicator
21+
import com.intellij.openapi.project.DumbAwareAction
2122
import com.intellij.openapi.project.DumbService
2223
import com.intellij.openapi.project.Project
2324
import com.intellij.openapi.util.Computable
@@ -97,6 +98,7 @@ import java.nio.file.Path
9798
import java.util.concurrent.CancellationException
9899
import java.util.concurrent.CountDownLatch
99100
import java.util.concurrent.TimeUnit
101+
import org.utbot.intellij.plugin.util.showSettingsEditor
100102
import org.utbot.sarif.*
101103

102104
object CodeGenerationController {
@@ -771,9 +773,9 @@ object CodeGenerationController {
771773
if (fileLength > UtSettings.maxTestFileSize && file.name != model.codegenLanguage.utilClassFileName) {
772774
CommonLoggingNotifier().notify(
773775
"Size of ${file.virtualFile.presentableName} exceeds configured limit " +
774-
"(${FileUtil.byteCountToDisplaySize(UtSettings.maxTestFileSize.toLong())}), reformatting was skipped. " +
775-
"The limit can be configured in '{HOME_DIR}/.utbot/settings.properties' with 'maxTestFileSize' property",
776-
model.project)
776+
"(${FileUtil.byteCountToDisplaySize(UtSettings.maxTestFileSize.toLong())}), reformatting was skipped.",
777+
model.project, model.testModule, arrayOf(DumbAwareAction.create("Configure the Limit") { showSettingsEditor(model.project, "maxTestFileSize") }
778+
))
777779
return
778780
}
779781

utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/ui/Notifications.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.intellij.notification.NotificationGroup
77
import com.intellij.notification.NotificationListener
88
import com.intellij.notification.NotificationType
99
import com.intellij.openapi.actionSystem.ActionManager
10+
import com.intellij.openapi.actionSystem.AnAction
1011
import com.intellij.openapi.application.ApplicationManager
1112
import com.intellij.openapi.keymap.KeymapUtil
1213
import com.intellij.openapi.module.Module
@@ -29,8 +30,13 @@ abstract class Notifier {
2930
protected open fun content(project: Project?, module: Module?, info: String): String = info
3031

3132
open fun notify(info: String, project: Project? = null, module: Module? = null) {
33+
notify(info, project, module, AnAction.EMPTY_ARRAY)
34+
}
35+
36+
open fun notify(info: String, project: Project? = null, module: Module? = null, actions: Array<AnAction>) {
3237
notificationGroup
33-
.createNotification(content(project, module, info), notificationType)
38+
.createNotification(content(project, module, info), notificationType)
39+
.apply { actions.forEach { this.addAction(it) } }
3440
.notify(project)
3541
}
3642

0 commit comments

Comments
 (0)