首页>代码>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日
最近浏览更多
windstorm 6月30日
暂无贡献等级
YafengLiang  LV15 6月9日
酷少小新  LV2 6月7日
dongxiaoyu  LV1 5月15日
597117933  LV9 5月13日
栈道小生  LV10 4月24日
ninuxf  LV12 4月24日
15515998549  LV1 4月22日
慵懒的小橘猫  LV11 4月11日
jackychen1012  LV2 3月29日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友