首页>代码>Idea插件,延长试用时间>/ide-eval-resetter-master/src/main/java/io/zhile/research/intellij/helper/NotificationHelper.java
package io.zhile.research.intellij.helper;

import com.intellij.icons.AllIcons;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.Nullable;

public class NotificationHelper {
    public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup(Constants.PLUGIN_ID.getIdString(), NotificationDisplayType.BALLOON, true, null, AllIcons.General.Reset);

    public static Notification show(@Nullable Project project, String title, String subtitle, String content, NotificationType type) {
        if (title == null) {
            title = Constants.PLUGIN_NAME;
        }

        Notification notification = NOTIFICATION_GROUP.createNotification(title, subtitle, content, type);
        notification.notify(project);

        return notification;
    }

    public static Notification showError(@Nullable Project project, String title, String subtitle, String content) {
        return show(project, title, subtitle, content, NotificationType.ERROR);
    }

    public static Notification showError(@Nullable Project project, String title, String content) {
        return showError(project, title, null, content);
    }

    public static Notification showError(@Nullable Project project, String content) {
        return showError(project, null, null, content);
    }

    public static Notification showWarn(@Nullable Project project, String title, String subtitle, String content) {
        return show(project, title, subtitle, content, NotificationType.WARNING);
    }

    public static Notification showWarn(@Nullable Project project, String title, String content) {
        return showWarn(project, title, null, content);
    }

    public static Notification showWarn(@Nullable Project project, String content) {
        return showWarn(project, null, null, content);
    }

    public static Notification showInfo(@Nullable Project project, String title, String subtitle, String content) {
        return show(project, title, subtitle, content, NotificationType.INFORMATION);
    }

    public static Notification showInfo(@Nullable Project project, String title, String content) {
        return showInfo(project, title, null, content);
    }

    public static Notification showInfo(@Nullable Project project, String content) {
        return showInfo(project, null, null, content);
    }
}
最近下载更多
最近浏览更多
FlyHeLanMan  LV11 昨天
JOEH60  LV10 昨天
林kkkkkk  LV6 10月31日
Peny_ZH  LV5 10月30日
best2018  LV46 10月30日
locklock  LV2 10月30日
MrReady  LV14 10月28日
dfaghrs  LV19 10月28日
BestClever  LV32 10月28日
Rommel  LV27 10月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友