LoginSignup
0
0

More than 3 years have passed since last update.

Notificationクラスを使ってEvent Logを出力する

Posted at

The most general way to display non-modal notifications is to use the Notifications class.

公式のドキュメントを参照すると、非モーダル通知を表示する一般的な実装と記載してある。
どのような挙動をするのか想像できなかったのでコードと画像を紹介します。

Version

  • IntelliJ IDEA 2019.3 (Community Edition)

使い方としてはNotifications.Bus.notifyメソッドの引数にNotificationクラスを渡すと利用できる。
第4引数に渡すNotificationTypeを変更する事によって見た目と出力されるテキストの色が変わる。

Information

緑色のバルーンと黒字で文字列が出力される。

Notifications.Bus.notify(
    Notification("sample", "hello", "hello! this is Information", NotificationType.INFORMATION)
)

screen_shot 2020-08-08 17.08.40.png
screen_shot 2020-08-08 17.08.59.png

Error

赤いバルーンと赤色の文字でログが出力される。

Notifications.Bus.notify(
    Notification("sample", "hello", "this is Error", NotificationType.ERROR)
)

screen_shot 2020-08-08 17.11.43.png
screen_shot 2020-08-08 17.11.56.png

Warning

黄色のバルーンと黄色の文字でログが出力される。


Notifications.Bus.notify(
    Notification("sample", "hello", "this is warning", NotificationType.WARNING)
)

screen_shot 2020-08-08 17.13.10.png
screen_shot 2020-08-08 17.13.21.png

(参考)

IntelliJ Platform SDK DevGuide - Notifications

IntelliJ IDEAのプラグインを作ろう!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0