diff --git a/src/com/shumyk/classcopier/actions/CopyClassFiles.java b/src/com/shumyk/classcopier/actions/CopyClassFiles.java index 92997c8..92e9041 100644 --- a/src/com/shumyk/classcopier/actions/CopyClassFiles.java +++ b/src/com/shumyk/classcopier/actions/CopyClassFiles.java @@ -32,6 +32,7 @@ public class CopyClassFiles extends AnAction { .forEach(change -> copyClassFile(change, compilerOut, sourceRoots, notificationWorker)); notificationWorker.doNotify(); + notificationWorker.notifySuccess(); } /** diff --git a/src/com/shumyk/classcopier/notificator/NotificationWorker.java b/src/com/shumyk/classcopier/notificator/NotificationWorker.java index a6117e6..9c95af8 100644 --- a/src/com/shumyk/classcopier/notificator/NotificationWorker.java +++ b/src/com/shumyk/classcopier/notificator/NotificationWorker.java @@ -1,5 +1,6 @@ package com.shumyk.classcopier.notificator; +import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.openapi.project.Project; @@ -10,15 +11,20 @@ */ public class NotificationWorker { + private final Project project; + private static final String GROUP_ID_FFF = "ClassCopierFailedFindFiles"; private static final String GROUP_ID_FCF = "ClassCopierFailedCopyFiles"; private static final String GROUP_ID_NF = "ClassCopierNewFile"; + private static final String GROUP_ID_SE = "ClassCopierSuccessEnd"; private static final String TITLE = "ClassCopier"; private static final String TITLE_NF = "ClassCopier: Add new file to VSC"; + private static final String TITLE_SE = "ClassCopier: Success"; private static final String MAIN_MESSAGE_FC = "Can't copy files.\nPlease check that files have not read-only status:"; private static final String MAIN_MESSAGE_FF = "Apparently, output folder is empty.\nCouldn't find:\n"; private static final String MAIN_MESSAGE_NF = "New files was added to VSC, so class files were copied to source root.\nPlease, add copied class files to VSC:\n"; + private static final String MAIN_MESSAGE_SE = "ClassCopier finished successfully, copied files should be shown in VSC window. \nIf not, please, try to refresh VSC window."; private NotificationCollector failedFindNotificator; private NotificationCollector failedCopyNotificator; @@ -30,6 +36,7 @@ public class NotificationWorker { * @param project - current project where notifications should appear. */ public NotificationWorker(Project project) { + this.project = project; failedFindNotificator = new NotificationCollector(GROUP_ID_FFF, project, TITLE, NotificationType.ERROR); failedCopyNotificator = new NotificationCollector(GROUP_ID_FCF, project, TITLE, NotificationType.ERROR); newFileNotificator = new NotificationCollector(GROUP_ID_NF, project, TITLE_NF, NotificationType.INFORMATION); @@ -67,4 +74,9 @@ public void doNotify() { failedCopyNotificator.doNotify(); newFileNotificator.doNotify(); } + + public void notifySuccess() { + Notification successNotification = new Notification(GROUP_ID_SE, TITLE_SE, MAIN_MESSAGE_SE, NotificationType.INFORMATION); + successNotification.notify(project); + } }