mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
notifications.md: formatting
This commit is contained in:
parent
ca6b78daf8
commit
37c5098449
@ -30,7 +30,8 @@ A commonly used UI implementation is [`EditorNotificationPanel`](upsource:///pla
|
|||||||
|
|
||||||
### "Got It" Notification
|
### "Got It" Notification
|
||||||
|
|
||||||
Use to highlight important new/changed features via [`GotItMessage`](upsource:///platform/platform-impl/src/com/intellij/ui/GotItMessage.java).See [Got It tooltip](https://jetbrains.design/intellij/controls/got_it_tooltip/) in IntelliJ Platform UI Guidelines for an overview.
|
Use to highlight important new/changed features via [`GotItMessage`](upsource:///platform/platform-impl/src/com/intellij/ui/GotItMessage.java).
|
||||||
|
See [Got It tooltip](https://jetbrains.design/intellij/controls/got_it_tooltip/) in IntelliJ Platform UI Guidelines for an overview.
|
||||||
|
|
||||||
### Top-Level Notifications (Balloons)
|
### Top-Level Notifications (Balloons)
|
||||||
|
|
||||||
@ -43,7 +44,8 @@ It has two main advantages:
|
|||||||
|
|
||||||
For UI reference, see [Balloon](https://jetbrains.design/intellij/controls/balloon/) in the IntelliJ Platform UI Guidelines.
|
For UI reference, see [Balloon](https://jetbrains.design/intellij/controls/balloon/) in the IntelliJ Platform UI Guidelines.
|
||||||
|
|
||||||
The specific method used to display a notification is [`Notifications.Bus.notify()`](upsource:///platform/ide-core/src/com/intellij/notification/Notifications.java). If the current Project is known, please use overload with `Project` parameter, so the notification is shown in its associated frame.
|
The specific method used to display a notification is [`Notifications.Bus.notify()`](upsource:///platform/ide-core/src/com/intellij/notification/Notifications.java).
|
||||||
|
If the current Project is known, please use overload with `Project` parameter, so the notification is shown in its associated frame.
|
||||||
|
|
||||||
The text of the notification can include HTML tags.
|
The text of the notification can include HTML tags.
|
||||||
|
|
||||||
@ -64,8 +66,11 @@ Please see the following steps for setup, depending on the target platform versi
|
|||||||
Use `key` to provide a localized group display name.
|
Use `key` to provide a localized group display name.
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<notificationGroup id="Custom Notification Group" displayType="BALLOON" key="notification.group.name"/>
|
<notificationGroup id="Custom Notification Group"
|
||||||
|
displayType="BALLOON"
|
||||||
|
key="notification.group.name"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -78,14 +83,17 @@ Registered instances can then be obtained via their `id`.
|
|||||||
```java
|
```java
|
||||||
public class MyNotifier {
|
public class MyNotifier {
|
||||||
|
|
||||||
public static void notifyError(@Nullable Project project, String content) {
|
public static void notifyError(@Nullable Project project,
|
||||||
NotificationGroupManager.getInstance().getNotificationGroup("Custom Notification Group")
|
String content) {
|
||||||
|
NotificationGroupManager.getInstance()
|
||||||
|
.getNotificationGroup("Custom Notification Group")
|
||||||
.createNotification(content, NotificationType.ERROR)
|
.createNotification(content, NotificationType.ERROR)
|
||||||
.notify(project);
|
.notify(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</tab>
|
</tab>
|
||||||
|
|
||||||
<tab title="Pre-2020.3">
|
<tab title="Pre-2020.3">
|
||||||
@ -105,6 +113,7 @@ public class MyNotifier {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</tab>
|
</tab>
|
||||||
|
|
||||||
</tabs>
|
</tabs>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user