mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
tool_windows.md: add TW FAQ section
This commit is contained in:
parent
769fb18072
commit
b4190e49d6
@ -1,7 +1,7 @@
|
|||||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
|
|
||||||
|
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||||
|
|
||||||
<link-summary>Notifying users about errors, action statuses or other events without interrupting their workflow by showing modal message boxes requiring confirmation.</link-summary>
|
<link-summary>Notifying users about errors, action statuses or other events without interrupting their workflow by showing modal message boxes requiring confirmation.</link-summary>
|
||||||
|
|
||||||
<tldr>
|
<tldr>
|
||||||
@ -52,6 +52,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.
|
||||||
|
|
||||||
|
> See [](tool_windows.md#tool-window-notification) for showing balloons on specific tool window.
|
||||||
|
|
||||||
The specific method used to display a notification is [`Notifications.Bus.notify()`](%gh-ic%/platform/ide-core/src/com/intellij/notification/Notifications.java).
|
The specific method used to display a notification is [`Notifications.Bus.notify()`](%gh-ic%/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.
|
If the current Project is known, please use overload with `Project` parameter, so the notification is shown in its associated frame.
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@ There are two main scenarios for the use of tool windows in a plugin.
|
|||||||
Using [declarative setup](#declarative-setup), a tool window button is always visible, and the user can activate it and interact with the plugin functionality at any time.
|
Using [declarative setup](#declarative-setup), a tool window button is always visible, and the user can activate it and interact with the plugin functionality at any time.
|
||||||
Alternatively, using [programmatic setup](#programmatic-setup), the tool window is created to show the results of a specific operation, and can then be closed after the operation is completed.
|
Alternatively, using [programmatic setup](#programmatic-setup), the tool window is created to show the results of a specific operation, and can then be closed after the operation is completed.
|
||||||
|
|
||||||
Project-level topic [`ToolWindowManagerListener`](%gh-ic%/platform/platform-impl/src/com/intellij/openapi/wm/ex/ToolWindowManagerListener.java) allows listening to tool window (un-)registering/show events (see [](plugin_listeners.md)).
|
|
||||||
|
|
||||||
### Declarative Setup
|
### Declarative Setup
|
||||||
|
|
||||||
The tool window is registered in <path>[plugin.xml](plugin_configuration_file.md)</path> using the `com.intellij.toolWindow` extension point.
|
The tool window is registered in <path>[plugin.xml](plugin_configuration_file.md)</path> using the `com.intellij.toolWindow` extension point.
|
||||||
@ -94,11 +92,25 @@ The default value is `false`; calling `setClosable(true)` on `ContentManager` co
|
|||||||
|
|
||||||
If closing tabs is enabled in general, a plugin can disable closing of specific tabs by calling [`Content.setCloseable(false)`](%gh-ic%/platform/ide-core/src/com/intellij/ui/content/Content.java).
|
If closing tabs is enabled in general, a plugin can disable closing of specific tabs by calling [`Content.setCloseable(false)`](%gh-ic%/platform/ide-core/src/com/intellij/ui/content/Content.java).
|
||||||
|
|
||||||
|
## Tool Window FAQ
|
||||||
|
|
||||||
|
### Accessing Tool Window
|
||||||
|
|
||||||
|
Use [`ToolWindowManager.getToolWindow()`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.kt) specifying the `id` used for [registration](#declarative-setup).
|
||||||
|
|
||||||
|
### Tool Window Notification
|
||||||
|
|
||||||
|
[`ToolWindowManager.notifyByBalloon()`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.kt) allows showing a notification for the given tool window.
|
||||||
|
|
||||||
|
### Events
|
||||||
|
|
||||||
|
Project-level topic [`ToolWindowManagerListener`](%gh-ic%/platform/platform-impl/src/com/intellij/openapi/wm/ex/ToolWindowManagerListener.java) allows listening to tool window registration/show events (see [](plugin_listeners.md)).
|
||||||
|
|
||||||
## Sample Plugin
|
## Sample Plugin
|
||||||
|
|
||||||
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code samples](%gh-sdk-samples%/tool_window).
|
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code samples](%gh-sdk-samples%/tool_window).
|
||||||
|
|
||||||
See [Code Samples](code_samples.md) on how to set up and run the plugin.
|
See [](code_samples.md) on how to set up and run the plugin.
|
||||||
|
|
||||||
This plugin creates the <control>Sample Calendar</control> tool window that displays the system date, time and time zone.
|
This plugin creates the <control>Sample Calendar</control> tool window that displays the system date, time and time zone.
|
||||||
When opened, this tool window is similar to the following screen:
|
When opened, this tool window is similar to the following screen:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user