Skip to content

Commit 79663b0

Browse files
authored
Remove usage of deprecated Notification.setListener(..) (#8317)
Also: cleanup of nullability parameters in `FlutterMessages.java`
1 parent 025ee79 commit 79663b0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

flutter-idea/src/io/flutter/FlutterMessages.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package io.flutter;
77

88
import com.intellij.notification.Notification;
9-
import com.intellij.notification.NotificationListener;
109
import com.intellij.notification.NotificationType;
1110
import com.intellij.notification.Notifications;
1211
import com.intellij.openapi.project.Project;
@@ -23,24 +22,24 @@ public class FlutterMessages {
2322
private FlutterMessages() {
2423
}
2524

26-
public static void showError(String title, @NotNull String message, @Nullable Project project) {
25+
public static void showError(@NotNull String title, @NotNull String message, @Nullable Project project) {
2726
Notifications.Bus.notify(
2827
new Notification(FLUTTER_NOTIFICATION_GROUP_ID,
2928
title,
3029
message,
3130
NotificationType.ERROR), project);
3231
}
3332

34-
public static void showWarning(String title, String message, @Nullable Project project) {
33+
public static void showWarning(@NotNull String title, @NotNull String message, @Nullable Project project) {
3534
Notifications.Bus.notify(
3635
new Notification(
3736
FLUTTER_NOTIFICATION_GROUP_ID,
3837
title,
3938
message,
40-
NotificationType.WARNING).setListener(NotificationListener.URL_OPENING_LISTENER), project);
39+
NotificationType.WARNING), project);
4140
}
4241

43-
public static void showInfo(String title, String message, @Nullable Project project) {
42+
public static void showInfo(@NotNull String title, @NotNull String message, @Nullable Project project) {
4443
final Notification notification = new Notification(
4544
FLUTTER_NOTIFICATION_GROUP_ID,
4645
title,

flutter-idea/src/io/flutter/run/daemon/DeviceDaemon.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.intellij.openapi.ui.Messages;
1919
import com.intellij.openapi.util.SystemInfo;
2020
import com.intellij.openapi.util.io.FileUtil;
21+
import com.intellij.openapi.util.text.StringUtil;
2122
import io.flutter.FlutterMessages;
2223
import io.flutter.FlutterUtils;
2324
import io.flutter.android.IntelliJAndroidSdk;
@@ -361,14 +362,16 @@ public void onDaemonLogMessage(@NotNull DaemonEvent.DaemonLogMessage message) {
361362

362363
@Override
363364
public void onDaemonShowMessage(@NotNull DaemonEvent.DaemonShowMessage event) {
364-
if ("error".equals(event.level)) {
365-
FlutterMessages.showError(event.title, event.message, null);
366-
}
367-
else if ("warning".equals(event.level)) {
368-
FlutterMessages.showWarning(event.title, event.message, null);
369-
}
370-
else {
371-
FlutterMessages.showInfo(event.title, event.message, null);
365+
if (StringUtil.isNotEmpty(event.level) && StringUtil.isNotEmpty(event.title) && StringUtil.isNotEmpty(event.message)) {
366+
if ("error".equals(event.level)) {
367+
FlutterMessages.showError(event.title, event.message, null);
368+
}
369+
else if ("warning".equals(event.level)) {
370+
FlutterMessages.showWarning(event.title, event.message, null);
371+
}
372+
else {
373+
FlutterMessages.showInfo(event.title, event.message, null);
374+
}
372375
}
373376
}
374377

0 commit comments

Comments
 (0)