override fun collectNotificationData()

in src/main/kotlin/com/intellij/ideolog/file/LogLargeFileNotificationProvider.kt [22:53]


  override fun collectNotificationData(project: Project, file: VirtualFile): Function<in FileEditor, out JComponent?> {
    return Function {
      if (it !is LogFileEditor) return@Function null
      val editor = (it as TextEditor).editor
      val productName = ApplicationNamesInfo.getInstance().productName.lowercase(Locale.getDefault())
      val versionName = ApplicationInfo.getInstance().majorVersion
      val isSupported = productName == "rider" && versionName >= "2018"
      if (editor.getUserData(HIDDEN_KEY) != null || dontShowAgain || !file.isTooLarge() || !isSupported) {
        return@Function null
      }

      val panel = EditorNotificationPanel().apply {
        createActionLabel(IdeologBundle.message("link.label.increase.limits.to.1gb")) {
          VMOptions.setOption("idea.max.content.load.filesize", "1000000")
          VMOptions.setOption("idea.max.content.load.large.preview.size", "1000000")
          VMOptions.setOption("idea.max.intellisense.filesize", "1000000")

          update(file, project)
        }
        createActionLabel(IdeologBundle.message("link.label.hide.notification")) {
          editor.putUserData(HIDDEN_KEY, "true")
          update(file, project)
        }
        createActionLabel(IdeologBundle.message("link.label.don.t.show.again")) {
          dontShowAgain = true
          update(file, project)
        }
      }

      return@Function panel.text(IdeologBundle.message("label.file.content.truncated.please.increase.limits"))
    }
  }