Notification.setImportant

This commit is contained in:
peter
2012-02-13 21:24:28 +01:00
parent 49a5e31f71
commit ec689f7b89
3 changed files with 12 additions and 13 deletions
@@ -38,6 +38,7 @@ public class Notification {
private final NotificationListener myListener;
private final String myTitle;
private boolean myExpired;
private Boolean myImportant;
private WeakReference<Balloon> myBalloonRef;
public Notification(@NotNull final String groupDisplayId, @NotNull final String title, @NotNull final String content, @NotNull final NotificationType type) {
@@ -136,7 +137,16 @@ public class Notification {
Notifications.Bus.notify(this, project);
}
public Notification setImportant(boolean important) {
myImportant = important;
return this;
}
public boolean isImportant() {
if (myImportant != null) {
return myImportant;
}
return getListener() != null;
}
}
@@ -164,7 +164,7 @@ public class ITNReporter extends ErrorReportSubmitter {
} : null;
ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
text.toString(),
type, listener).notify(project);
type, listener).setImportant(false).notify(project);
}
});
}
@@ -283,7 +283,7 @@ class GitPushResult {
NotificationListener viewUpdateFilesListener = new ViewUpdatedFilesNotificationListener(updatedFiles);
if (onlySuccess) {
return new MySuccessfulNotification(title, sb.toString(), notificationType, viewUpdateFilesListener);
return new Notification(GitVcs.NOTIFICATION_GROUP_ID.getDisplayId(), title, sb.toString(), notificationType, viewUpdateFilesListener).setImportant(false);
}
return new Notification(GitVcs.IMPORTANT_ERROR_NOTIFICATION.getDisplayId(), title, sb.toString(), notificationType, viewUpdateFilesListener);
@@ -360,17 +360,6 @@ class GitPushResult {
return commitNum + " " + StringUtil.pluralize("commit", commitNum);
}
private static class MySuccessfulNotification extends Notification {
public MySuccessfulNotification(@NotNull String title, @NotNull String message, @NotNull NotificationType notificationType,
@NotNull NotificationListener listener) {
super(GitVcs.NOTIFICATION_GROUP_ID.getDisplayId(), title, message, notificationType, listener);
}
@Override public boolean isImportant() {
return false; // don't highlight event log if push was totally successful
}
}
private class ViewUpdatedFilesNotificationListener implements NotificationListener {
private final UpdatedFiles myUpdatedFiles;