11package com.github.oldmegit.goframehelper.listener
22
3+ import com.github.oldmegit.goframehelper.data.Bundle
34import com.github.oldmegit.goframehelper.gf.Gf
45import com.github.oldmegit.goframehelper.gf.GfGoMod
56import com.goide.GoFileType
67import com.intellij.openapi.project.Project
78import com.intellij.openapi.vfs.newvfs.BulkFileListener
89import com.intellij.openapi.vfs.newvfs.events.VFileEvent
10+ import com.intellij.notification.NotificationGroupManager
11+ import com.intellij.notification.NotificationType
912import java.io.File
1013
1114class Listener (private val project : Project ): BulkFileListener {
@@ -26,10 +29,18 @@ class Listener(private val project: Project): BulkFileListener {
2629 }
2730
2831 val runtime = Runtime .getRuntime()
29- if (Gf .isApiFile(project, file) && Gf .enableApiWatch(project)) {
30- runtime.exec(Gf .gfGenCtrl, null , File (project.basePath.toString()))
31- } else if (Gf .isLogicFile(project, file) && Gf .enableLogicWatch(project)) {
32- runtime.exec(Gf .gfGenService, null , File (project.basePath.toString()))
32+ try {
33+ if (Gf .isApiFile(project, file) && Gf .enableApiWatch(project)) {
34+ runtime.exec(Gf .gfGenCtrl, null , File (project.basePath.toString()))
35+ } else if (Gf .isLogicFile(project, file) && Gf .enableLogicWatch(project)) {
36+ runtime.exec(Gf .gfGenService, null , File (project.basePath.toString()))
37+ }
38+ } catch (_: Exception ) {
39+ val message = Bundle .getMessage(" gfExecErrNotify" )
40+ NotificationGroupManager .getInstance()
41+ .getNotificationGroup(" GoFrame Help Notify" )
42+ .createNotification(message, NotificationType .INFORMATION )
43+ .notify(project)
3344 }
3445 }
3546 }
0 commit comments