use of com.intellij.notification.NotificationGroup in project intellij-community by JetBrains.
the class ExternalSystemNotificationManager method showNotification.
public void showNotification(@NotNull final ProjectSystemId externalSystemId, @NotNull final NotificationData notificationData) {
myUpdater.submit(() -> {
if (myProject.isDisposed())
return;
final Application app = ApplicationManager.getApplication();
Runnable action = () -> {
if (!initializedExternalSystem.contains(externalSystemId)) {
app.runWriteAction(() -> {
if (myProject.isDisposed())
return;
ExternalSystemUtil.ensureToolWindowContentInitialized(myProject, externalSystemId);
initializedExternalSystem.add(externalSystemId);
});
}
if (myProject.isDisposed())
return;
NotificationGroup group;
if (notificationData.getBalloonGroup() == null) {
ExternalProjectsView externalProjectsView = ExternalProjectsManager.getInstance(myProject).getExternalProjectsView(externalSystemId);
group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl) externalProjectsView).getNotificationGroup() : null;
} else {
final NotificationGroup registeredGroup = NotificationGroup.findRegisteredGroup(notificationData.getBalloonGroup());
group = registeredGroup != null ? registeredGroup : NotificationGroup.balloonGroup(notificationData.getBalloonGroup());
}
if (group == null)
return;
final Notification notification = group.createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType(), notificationData.getListener());
myNotifications.add(notification);
if (notificationData.isBalloonNotification()) {
applyNotification(notification);
} else {
addMessage(notification, externalSystemId, notificationData);
}
};
app.invokeLater(action, ModalityState.defaultModalityState(), myProject.getDisposed());
});
}
use of com.intellij.notification.NotificationGroup in project intellij-community by JetBrains.
the class GitPushResultNotification method create.
@NotNull
static GitPushResultNotification create(@NotNull Project project, @NotNull GitPushResult pushResult, boolean multiRepoProject) {
GroupedPushResult grouped = GroupedPushResult.group(pushResult.getResults());
String title;
NotificationType type;
if (!grouped.errors.isEmpty()) {
if (!grouped.successful.isEmpty()) {
title = "Push partially failed";
} else {
title = "Push failed";
}
type = NotificationType.ERROR;
} else if (!grouped.rejected.isEmpty() || !grouped.customRejected.isEmpty()) {
if (!grouped.successful.isEmpty()) {
title = "Push partially rejected";
} else {
title = "Push rejected";
}
type = NotificationType.WARNING;
} else {
title = "Push successful";
type = NotificationType.INFORMATION;
}
String description = formDescription(pushResult.getResults(), multiRepoProject);
ViewUpdatedFilesNotificationListener listener = null;
UpdatedFiles updatedFiles = pushResult.getUpdatedFiles();
if (!updatedFiles.isEmpty()) {
description += "<br/>" + VIEW_FILES_UPDATED_DURING_THE_PUSH;
listener = new ViewUpdatedFilesNotificationListener(project, updatedFiles, pushResult.getBeforeUpdateLabel(), pushResult.getAfterUpdateLabel());
}
NotificationGroup group = type == NotificationType.INFORMATION ? VcsNotifier.NOTIFICATION_GROUP_ID : VcsNotifier.IMPORTANT_ERROR_NOTIFICATION;
return new GitPushResultNotification(group.getDisplayId(), title, description, type, listener);
}
use of com.intellij.notification.NotificationGroup in project flutter-intellij by flutter.
the class FlutterReloadManager method getNotificationGroup.
private static NotificationGroup getNotificationGroup(String toolWindowId) {
if (!toolWindowNotificationGroups.containsKey(toolWindowId)) {
final NotificationGroup notificationGroup = NotificationGroup.toolWindowGroup("Flutter " + toolWindowId, toolWindowId, false);
toolWindowNotificationGroups.put(toolWindowId, notificationGroup);
}
return toolWindowNotificationGroups.get(toolWindowId);
}
use of com.intellij.notification.NotificationGroup in project flutter-intellij by flutter.
the class FlutterReloadManager method showAnalysisNotification.
private void showAnalysisNotification(@NotNull String title, @NotNull String content, boolean isError) {
if (!ToolWindowManager.getInstance(myProject).getToolWindow(DartProblemsView.TOOLWINDOW_ID).isVisible()) {
content += " (<a href='open.analysis.view'>view issues</a>)";
}
final NotificationGroup notificationGroup = getNotificationGroup(DartProblemsView.TOOLWINDOW_ID);
final Notification notification = notificationGroup.createNotification(title, content, isError ? NotificationType.ERROR : NotificationType.INFORMATION, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull final Notification notification, @NotNull final HyperlinkEvent e) {
notification.expire();
ToolWindowManager.getInstance(myProject).getToolWindow(DartProblemsView.TOOLWINDOW_ID).activate(null);
}
});
notification.setIcon(FlutterIcons.Flutter);
notification.notify(myProject);
}
use of com.intellij.notification.NotificationGroup in project flutter-intellij by flutter.
the class FlutterReloadManager method showRunNotification.
private Notification showRunNotification(@NotNull FlutterApp app, @Nullable String title, @NotNull String content, boolean isError) {
final String toolWindowId = app.getMode() == RunMode.DEBUG ? ToolWindowId.DEBUG : ToolWindowId.RUN;
final NotificationGroup notificationGroup = getNotificationGroup(toolWindowId);
final Notification notification;
if (title == null) {
notification = notificationGroup.createNotification(content, isError ? NotificationType.ERROR : NotificationType.INFORMATION);
} else {
notification = notificationGroup.createNotification(title, content, isError ? NotificationType.ERROR : NotificationType.INFORMATION, null);
}
notification.setIcon(FlutterIcons.Flutter);
notification.notify(myProject);
return notification;
}
Aggregations