Skip to content

Commit

Permalink
Update notification usage to current API
Browse files Browse the repository at this point in the history
  • Loading branch information
leinardi committed Oct 4, 2024
1 parent d0afc23 commit 1801d4a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/main/java/com/leinardi/pycharm/pylint/util/Notifications.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.io.PrintWriter;
import java.io.StringWriter;

import static com.intellij.notification.NotificationListener.URL_OPENING_LISTENER;
import static com.intellij.notification.NotificationType.ERROR;
import static com.intellij.notification.NotificationType.INFORMATION;
import static com.intellij.notification.NotificationType.WARNING;
Expand All @@ -59,35 +58,30 @@ private Notifications() {
public static void showInfo(final Project project, final String infoText) {
BALLOON_GROUP
.createNotification(TITLE, infoText, INFORMATION)
.setListener(URL_OPENING_LISTENER)
.notify(project);
}

public static void showWarning(final Project project, final String warningText) {
BALLOON_GROUP
.createNotification(TITLE, warningText, WARNING)
.setListener(URL_OPENING_LISTENER)
.notify(project);
}

public static void showWarning(final Project project, final String title, final String warningText) {
BALLOON_GROUP
.createNotification(title, warningText, WARNING)
.setListener(URL_OPENING_LISTENER)
.notify(project);
}

public static void showError(final Project project, final String errorText) {
BALLOON_GROUP
.createNotification(TITLE, errorText, ERROR)
.setListener(URL_OPENING_LISTENER)
.notify(project);
}

public static void showException(final Project project, final Throwable t) {
LOG_ONLY_GROUP
.createNotification(message("plugin.exception"), messageFor(t), ERROR)
.setListener(URL_OPENING_LISTENER)
.notify(project);
}

Expand All @@ -97,8 +91,7 @@ public static void showInstallPylint(final Project project) {
TITLE,
PylintBundle.message("plugin.notification.install-pylint.content"),
ERROR)
.setSubtitle(PylintBundle.message("plugin.notification.install-pylint.subtitle"))
.setListener(URL_OPENING_LISTENER);
.setSubtitle(PylintBundle.message("plugin.notification.install-pylint.subtitle"));
notification
.addAction(new InstallPylintAction(project, notification))
.notify(project);
Expand All @@ -110,8 +103,7 @@ public static void showUnableToRunPylint(final Project project) {
TITLE,
PylintBundle.message("plugin.notification.unable-to-run-pylint.content"),
ERROR)
.setSubtitle(PylintBundle.message("plugin.notification.unable-to-run-pylint.subtitle"))
.setListener(URL_OPENING_LISTENER);
.setSubtitle(PylintBundle.message("plugin.notification.unable-to-run-pylint.subtitle"));
notification
.addAction(new OpenPluginSettingsAction(notification))
.notify(project);
Expand All @@ -120,7 +112,6 @@ public static void showUnableToRunPylint(final Project project) {
public static void showPylintAbnormalExit(final Project project, final String detail) {
BALLOON_GROUP
.createNotification(TITLE, detail, ERROR)
.setListener(URL_OPENING_LISTENER)
.setSubtitle(PylintBundle.message("plugin.notification.abnormal-exit.subtitle"))
.notify(project);
}
Expand All @@ -130,8 +121,7 @@ public static void showNoPythonInterpreter(Project project) {
.createNotification(
TITLE,
PylintBundle.message("plugin.notification.no-python-interpreter.content"),
ERROR)
.setListener(URL_OPENING_LISTENER);
ERROR);
notification
.addAction(new ConfigurePythonInterpreterAction(project, notification))
.notify(project);
Expand Down

0 comments on commit 1801d4a

Please sign in to comment.