|
|
@@ -1,3 +1,5 @@
|
|
|
+package util
|
|
|
+
|
|
|
import com.intellij.notification.NotificationType
|
|
|
import com.intellij.openapi.project.Project
|
|
|
import com.intellij.notification.NotificationDisplayType
|
|
|
@@ -5,23 +7,18 @@ import com.intellij.notification.NotificationDisplayType
|
|
|
import com.intellij.notification.NotificationGroup
|
|
|
import constant.Constants
|
|
|
|
|
|
-
|
|
|
-enum class NotifierType {
|
|
|
- INFO, WARM, ERROR
|
|
|
-}
|
|
|
-
|
|
|
object NotifierUtil {
|
|
|
private val NOTIFICATION_GROUP =
|
|
|
- NotificationGroup("Custom Notification Group", NotificationDisplayType.BALLOON, true)
|
|
|
+ NotificationGroup("Custom Notification Group", NotificationDisplayType.BALLOON, true)
|
|
|
|
|
|
fun showNotifier(
|
|
|
- project: Project,
|
|
|
- content: String,
|
|
|
- title: String = Constants.title,
|
|
|
- type: NotifierType = NotifierType.INFO
|
|
|
+ project: Project,
|
|
|
+ content: String,
|
|
|
+ title: String? = null,
|
|
|
+ type: NotifierType = NotifierType.INFO
|
|
|
) = NOTIFICATION_GROUP
|
|
|
- .createNotification(title, content, getNotifierByType(type))
|
|
|
- .notify(project);
|
|
|
+ .createNotification(title.let { "${Constants.title} ${type.name}" }, content, getNotifierByType(type))
|
|
|
+ .notify(project);
|
|
|
|
|
|
private fun getNotifierByType(type: NotifierType): NotificationType {
|
|
|
return when (type) {
|
|
|
@@ -30,4 +27,8 @@ object NotifierUtil {
|
|
|
NotifierType.ERROR -> NotificationType.ERROR
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+enum class NotifierType {
|
|
|
+ INFO, WARM, ERROR
|
|
|
}
|