Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/com/shumyk/classcopier/actions/CopyClassFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class CopyClassFiles extends AnAction {
.forEach(change -> copyClassFile(change, compilerOut, sourceRoots, notificationWorker));

notificationWorker.doNotify();
notificationWorker.notifySuccess();
}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/com/shumyk/classcopier/notificator/NotificationWorker.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
}