Skip to content

Commit dd1f4ea

Browse files
committed
Add adaptation of the new notification api
1 parent 5013b18 commit dd1f4ea

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/java/com/airsaid/localization/action/TranslateAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void onTranslateSuccess() {
100100

101101
@Override
102102
public void onTranslateError(Throwable e) {
103-
NotificationUtil.notifyWarning(mProject, "Translation error: " + e);
103+
NotificationUtil.notifyError(mProject, "Translation failure: " + e.getLocalizedMessage());
104104
}
105105
});
106106
translationTask.queue();

src/main/java/com/airsaid/localization/utils/NotificationUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
package com.airsaid.localization.utils;
1919

20-
import com.intellij.notification.NotificationDisplayType;
2120
import com.intellij.notification.NotificationGroup;
21+
import com.intellij.notification.NotificationGroupManager;
2222
import com.intellij.notification.NotificationType;
2323
import com.intellij.openapi.project.Project;
2424
import org.jetbrains.annotations.Nullable;
@@ -28,10 +28,10 @@
2828
*/
2929
public class NotificationUtil {
3030

31-
private static final String NOTIFICATION_GROUP_ID = "com.github.airsaid.androidlocalize.Notification";
31+
private static final String NOTIFICATION_GROUP_ID = "Android Localize Plugin";
3232

3333
private static final NotificationGroup NOTIFICATION_GROUP =
34-
new NotificationGroup(NOTIFICATION_GROUP_ID, NotificationDisplayType.BALLOON, true);
34+
NotificationGroupManager.getInstance().getNotificationGroup(NOTIFICATION_GROUP_ID);
3535

3636
private NotificationUtil() {
3737
throw new AssertionError("No com.airsaid.localization.utils.NotificationUtil instances for you!");
@@ -51,5 +51,4 @@ public static void notifyError(@Nullable Project project, String content) {
5151
NOTIFICATION_GROUP.createNotification(content, NotificationType.ERROR)
5252
.notify(project);
5353
}
54-
5554
}

src/main/resources/META-INF/plugin.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
<applicationConfigurable parentId="tools"
5252
instance="com.airsaid.localization.config.SettingsConfigurable"
5353
id="com.airsaid.localization.config.SettingsConfigurable"/>
54+
55+
<notificationGroup id="Android Localize Plugin"
56+
displayType="BALLOON"/>
5457
</extensions>
5558

5659
<actions>

0 commit comments

Comments
 (0)