package com.rthoni.intellij.codefromds.ui.others;

import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;

/**
 * Created by robin on 11/18/16.
 */
public class NotificationsService {

    public static NotificationsService getInstance() {
        return ServiceManager.getService(NotificationsService.class);
    }

    public void showNotification(String title, String content, NotificationType type)
    {
        ApplicationManager.getApplication().invokeLater(() -> {
            Notification n = new Notification("Code From Ds", title, content, type);
            Notifications.Bus.notify(n);
        });
    }

    public void showErrorNotification(String title, String content)
    {
        showNotification(title, content, NotificationType.ERROR);
    }

    public void showInfoNotification(String title, String content)
    {
        showNotification(title, content, NotificationType.INFORMATION);
    }
}
