use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class PluginManagerMain method notifyPluginsUpdated.
public static void notifyPluginsUpdated(@Nullable Project project) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
String title = IdeBundle.message("update.notifications.title");
String action = IdeBundle.message(app.isRestartCapable() ? "ide.restart.action" : "ide.shutdown.action");
String message = IdeBundle.message("ide.restart.required.notification", action, ApplicationNamesInfo.getInstance().getFullProductName());
NotificationListener listener = new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
notification.expire();
app.restart(true);
}
};
UpdateChecker.NOTIFICATIONS.createNotification(title, XmlStringUtil.wrapInHtml(message), NotificationType.INFORMATION, listener).notify(project);
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class IdeNotificationArea method updateStatus.
private void updateStatus() {
final Project project = getProject();
ArrayList<Notification> notifications = EventLog.getLogModel(project).getNotifications();
applyIconToStatusAndToolWindow(project, createIconWithNotificationCount(notifications));
int count = notifications.size();
setToolTipText(count > 0 ? String.format("%s notification%s pending", count, count == 1 ? "" : "s") : "No new notifications");
myStatusBar.updateWidget(ID());
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class IdeMessagePanel method showErrorNotification.
private void showErrorNotification(@Nullable String notificationText, @NotNull Project project) {
Notification notification = new Notification("", AllIcons.Ide.FatalError, notificationText == null ? ERROR_TITLE : "", null, notificationText == null ? "" : notificationText, NotificationType.ERROR, null);
if (notificationText == null) {
notification.addAction(new NotificationAction(ERROR_LINK) {
@Override
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
notification.expire();
_openFatals(null);
}
});
}
BalloonLayout layout = myFrame.getBalloonLayout();
assert layout != null;
BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
layoutData.fadeoutTime = 5000;
layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
assert myBalloon == null;
myBalloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
Disposer.register(myBalloon, () -> myBalloon = null);
layout.add(myBalloon);
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class DefaultIdeaErrorLogger method processMappingFailed.
private static void processMappingFailed(IdeaLoggingEvent event) throws InterruptedException, InvocationTargetException {
if (!ourMappingFailedNotificationPosted && SystemInfo.isWindows && SystemInfo.is32Bit) {
ourMappingFailedNotificationPosted = true;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") String exceptionMessage = event.getThrowable().getMessage();
String text = exceptionMessage + "<br>Possible cause: unable to allocate continuous memory chunk of necessary size.<br>" + "Reducing JVM maximum heap size (-Xmx) may help.";
Notifications.Bus.notify(new Notification("Memory", "Memory Mapping Failed", text, NotificationType.WARNING), null);
}
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class ProjectLoadingErrorsNotifierImpl method fireNotifications.
private void fireNotifications() {
final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<>();
synchronized (myLock) {
if (myErrors.isEmpty())
return;
descriptionsMap.putAllValues(myErrors);
myErrors.clear();
}
for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
if (descriptions.isEmpty())
continue;
final String invalidElements = getInvalidElementsString(type, descriptions);
final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";
Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, errorDescription -> errorDescription.isValid());
if (RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions)) {
notification.expire();
}
}
}), myProject);
}
}
Aggregations