首页>代码>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);
    }
}
最近下载更多
最代码官方  LV168 2024年11月3日
最近浏览更多
栈道小生  LV10 4月24日
ninuxf  LV12 4月24日
15515998549  LV1 4月22日
慵懒的小橘猫  LV11 4月11日
jackychen1012  LV2 3月29日
niuwa666 3月27日
暂无贡献等级
cier_666  LV1 3月20日
tinguo002  LV6 3月17日
luo900903  LV15 3月12日
hbsoft2008  LV16 2月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友