mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
Updated usage of 'toolwindow' to 'tool window'
This commit is contained in:
parent
15adeabd0d
commit
d4f293c1c5
@ -176,4 +176,4 @@ To ensure that your plugin is initialized on IDEA start-up, make the following c
|
||||
|
||||
If a plugin needs to include a toolbar or popup menu built from a group of actions in its own user interface, that can be accomplished through the [`ActionPopupMenu`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionPopupMenu.java) and [`ActionToolbar`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionToolbar.java) classes. These objects can be created through calls to `ActionManager.createActionPopupMenu` and `ActionManager.createActionToolbar`. To get a Swing component from such an object, simply call the getComponent() method.
|
||||
|
||||
If your action toolbar is attached to a specific component (for example, a panel in a toolwindow), you usually need to call `ActionToolbar.setTargetComponent()` and pass the instance of the related component as a parameter. This ensures that the state of the toolbar buttons depends on the state of the related component, and not on the current focus location within the IDE frame.
|
||||
If your action toolbar is attached to a specific component (for example, a panel in a tool window), you usually need to call `ActionToolbar.setTargetComponent()` and pass the instance of the related component as a parameter. This ensures that the state of the toolbar buttons depends on the state of the related component, and not on the current focus location within the IDE frame.
|
||||
|
@ -13,7 +13,7 @@ Implementations of `ProgramRunner.execute()` go through the following steps to e
|
||||
|
||||
* `RunProfile.getState()` method is called to create a [`RunProfileState`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/RunProfileState.java) object, describing a process about to be started. At this stage, the command line parameters, environment variables and other information required to start the process is initialized.
|
||||
* `RunProfileState.execute()` is called. It starts the process, attaches a `ProcessHandler` to its input and output streams, creates a console to display the process output, and returns an [`ExecutionResult`](upsource:///platform/lang-api/src/com/intellij/execution/ExecutionResult.java) object aggregating the console and the process handler.
|
||||
* The `RunContentBuilder` object is created and invoked to display the execution console in a tab of the Run or Debug toolwindow.
|
||||
* The `RunContentBuilder` object is created and invoked to display the execution console in a tab of the Run or Debug tool window.
|
||||
|
||||
## Executor
|
||||
|
||||
|
4
faq.md
4
faq.md
@ -101,7 +101,7 @@ This FAQ is a topical index of questions that have been asked (and answered) on
|
||||
* [How do I clear the read-only status of a file?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206142039-Clear-read-only-status)
|
||||
* [How do I show a popup hint in an editor?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206146719-HintManager-API-question)
|
||||
* [How do I create live template-like red box edit regions in an editor?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206800165-How-to-%C3%A7reate-live-template-like-red-box-edit-regions-in-an-editor)
|
||||
* [How can I show an editor with error highlighting in a toolwindow?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206146679-Error-highlighting-in-Editors)
|
||||
* [How can I show an editor with error highlighting in a tool window?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206146679-Error-highlighting-in-Editors)
|
||||
|
||||
## Inspections
|
||||
* [Can I build an inspection that processes XML files?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206139579-LocalInspectionTool-for-XML-files-/comments/206204765)
|
||||
@ -137,7 +137,7 @@ This FAQ is a topical index of questions that have been asked (and answered) on
|
||||
* [How do I print messages in the console view?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206141419-Putting-messages-into-console-window-)
|
||||
* [How do I show the package selector dialog programmatically?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206794265-Package-selector-dialog)
|
||||
* [How do I provide syntax and error highlighting in a combo box editor?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206800495-EditorTextField-in-3403-How-to-get-an-Editor-that-does-error-highlighting-)
|
||||
* [How can I get notified when my toolwindow is activated?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206800405-How-can-i-run-some-code-when-a-ToolWindow-activates)
|
||||
* [How can I get notified when my tool window is activated?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206800405-How-can-i-run-some-code-when-a-ToolWindow-activates)
|
||||
* [How can I provide Close and Rerun buttons in my Usage View window?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206146779-How-to-get-a-Close-button-in-an-own-Usage-View-)
|
||||
|
||||
## General
|
||||
|
@ -72,7 +72,7 @@ The text shown for each found element is taken from the
|
||||
[FindUsagesProvider.getNodeText()](upsource:///platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java)
|
||||
method.
|
||||
|
||||
To have the title of the found element be correctly displayed in the title of the Find Usages toolwindow, you need to provide an implementation of the
|
||||
To have the title of the found element be correctly displayed in the title of the Find Usages tool window, you need to provide an implementation of the
|
||||
[ElementDescriptionProvider](upsource:///platform/core-api/src/com/intellij/psi/ElementDescriptionProvider.java)
|
||||
interface.
|
||||
The
|
||||
|
@ -7,7 +7,7 @@ title: Editor Components
|
||||
Compared to
|
||||
[Swing JTextArea](http://docs.oracle.com/javase/8/docs/api/javax/swing/JTextArea.html), the
|
||||
*IntelliJ Platform's* editor component has a ton of advantages: syntax highlighting support, code completion, code folding and much more.
|
||||
*IntelliJ Platform* editors are normally displayed in editor tabs, but they can be embedded in dialogs or toolwindows, too.
|
||||
*IntelliJ Platform* editors are normally displayed in editor tabs, but they can be embedded in dialogs or tool windows, too.
|
||||
This is enabled by the
|
||||
[EditorTextField](upsource:///platform/platform-impl/src/com/intellij/ui/EditorTextField.java)
|
||||
component.
|
||||
|
@ -34,7 +34,7 @@ It has two main advantages:
|
||||
|
||||
* The user can control the way each notification type is displayed under `Settings | Notifications`
|
||||
|
||||
* All displayed notifications are gathered in the Event Log toolwindow and can be reviewed later
|
||||
* All displayed notifications are gathered in the Event Log tool window and can be reviewed later
|
||||
|
||||
The specific method used to display a notification is
|
||||
[Notifications.Bus.notify()](upsource:///platform/platform-api/src/com/intellij/notification/Notification.java).
|
||||
|
@ -7,54 +7,54 @@ title: Tool Windows
|
||||
|
||||
_Tool windows_ are child windows of the IDE used to display information. These windows generally have their own toolbars (referred to as _tool window bars_) along the outer edges of the main window containing one or more _tool window buttons_, which activate panels displayed on the left, bottom and right sides of the main IDE window. For detailed information about tool windows, please see [IntelliJ IDEA Web Help ](https://www.jetbrains.com/idea/help/tool-windows.html).
|
||||
|
||||
Each side contains two tool window groups, the primary and the secondary one, and only one toolwindow from each group can be active at a time.
|
||||
Each side contains two tool window groups, the primary and the secondary one, and only one tool window from each group can be active at a time.
|
||||
|
||||
Each toolwindow can show multiple tabs (or "contents", as they are called in the API).
|
||||
For example, the Run toolwindow displays a tab for each active run configuration, and the Changes toolwindow displays a fixed set of tabs depending on the version control system used in the project.
|
||||
Each tool window can show multiple tabs (or "contents", as they are called in the API).
|
||||
For example, the Run tool window displays a tab for each active run configuration, and the Changes tool window displays a fixed set of tabs depending on the version control system used in the project.
|
||||
|
||||
There are two main scenarios for the use of tool windows in a plugin.
|
||||
In the first scenario (used by the Ant and Commander plugins, for example), a toolwindow button is always visible, and the user can activate it and interact with the plugin functionality at any time.
|
||||
In the second scenario (used by the `Analyze Dependencies` action, for example), the toolwindow is created to show the results of a specific operation, and can be closed by the user after the operation is completed.
|
||||
In the first scenario (used by the Ant and Commander plugins, for example), a tool window button is always visible, and the user can activate it and interact with the plugin functionality at any time.
|
||||
In the second scenario (used by the `Analyze Dependencies` action, for example), the tool window is created to show the results of a specific operation, and can be closed by the user after the operation is completed.
|
||||
|
||||
In the first scenario, the toolwindow is registered in *plugin.xml* using the `<toolWindow>` extension point.
|
||||
The extension point attributes specify all the data which is necessary to display the toolwindow button:
|
||||
In the first scenario, the tool window is registered in *plugin.xml* using the `<tool window>` extension point.
|
||||
The extension point attributes specify all the data which is necessary to display the tool window button:
|
||||
|
||||
* The `id` of the toolwindow (corresponds to the text displayed on the toolwindow button)
|
||||
* The `id` of the tool window (corresponds to the text displayed on the tool window button)
|
||||
|
||||
* The `anchor`, meaning the side of the screen on which the toolwindow is displayed ("left", "right" or "bottom")
|
||||
* The `anchor`, meaning the side of the screen on which the tool window is displayed ("left", "right" or "bottom")
|
||||
|
||||
* The `secondary` attribute, specifying whether the toolwindow is displayed in the primary or the secondary group
|
||||
* The `secondary` attribute, specifying whether the tool window is displayed in the primary or the secondary group
|
||||
|
||||
* The `icon` to display on the toolwindow button (13x13 pixels)
|
||||
* The `icon` to display on the tool window button (13x13 pixels)
|
||||
|
||||
In addition to that, you specify the *factory class* - the name of a class implementing the
|
||||
[ToolWindowFactory](upsource:///platform/platform-api/src/com/intellij/openapi/wm/ToolWindowFactory.java)
|
||||
interface.
|
||||
When the user clicks on the toolwindow button, the `createToolWindowContent()` method of the factory class is called, and initializes the UI of the toolwindow.
|
||||
This procedure ensures that unused toolwindows don't cause any overhead in startup time or memory usage: if a user does not interact with the toolwindow of your plugin, no plugin code will be loaded or executed.
|
||||
When the user clicks on the tool window button, the `createToolWindowContent()` method of the factory class is called, and initializes the UI of the tool window.
|
||||
This procedure ensures that unused tool windows don't cause any overhead in startup time or memory usage: if a user does not interact with the tool window of your plugin, no plugin code will be loaded or executed.
|
||||
|
||||
If the toolwindow of your plugin doesn't need to be displayed for all projects, you can also specify the *conditionClass* attribute - the qualified name of a class implementing the
|
||||
If the tool window of your plugin doesn't need to be displayed for all projects, you can also specify the *conditionClass* attribute - the qualified name of a class implementing the
|
||||
[Condition\<Project\>](upsource:///platform/util-rt/src/com/intellij/openapi/util/Condition.java)
|
||||
interface (this can be the same class as the toolwindow factory implementation).
|
||||
If the condition returns `false`, the toolwindow will not be displayed.
|
||||
interface (this can be the same class as the tool window factory implementation).
|
||||
If the condition returns `false`, the tool window will not be displayed.
|
||||
Note that the condition is evaluated only once when the project is loaded;
|
||||
if you'd like to show your and hide toolwindow dynamically while the user is working with the project, you need to use the second method for toolwindow registration.
|
||||
if you'd like to show your and hide tool window dynamically while the user is working with the project, you need to use the second method for tool window registration.
|
||||
|
||||
The second method involves simply calling
|
||||
[ToolWindowManager.registerToolWindow()](upsource:///platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java)
|
||||
from your plugin code.
|
||||
The method has multiple overloads that can be used depending on your task.
|
||||
If you use an overload that takes a component, the component becomes the first content (tab) displayed in the toolwindow.
|
||||
If you use an overload that takes a component, the component becomes the first content (tab) displayed in the tool window.
|
||||
|
||||
Displaying the contents of many toolwindows requires access to the indexes.
|
||||
Because of that, toolwindows are normally disabled while building indices, unless you pass true as the value of `canWorkInDumbMode` to the `registerToolWindow()` function.
|
||||
Displaying the contents of many tool windows requires access to the indexes.
|
||||
Because of that, tool windows are normally disabled while building indices, unless you pass true as the value of `canWorkInDumbMode` to the `registerToolWindow()` function.
|
||||
|
||||
As mentioned previously, toolwindows can contain multiple tabs, or contents.
|
||||
To manage the contents of a toolwindow, you can call
|
||||
As mentioned previously, tool windows can contain multiple tabs, or contents.
|
||||
To manage the contents of a tool window, you can call
|
||||
[ToolWindow.getContentManager()](upsource:///platform/platform-api/src/com/intellij/openapi/wm/ToolWindow.java).
|
||||
To add a tab (content), you first need to create it by calling
|
||||
[ContentManager.getFactory().createContent()](upsource:///platform/platform-api/src/com/intellij/ui/content/ContentManager.java),
|
||||
and then to add it to the toolwindow using
|
||||
and then to add it to the tool window using
|
||||
[ContentManager.addContent()](upsource:///platform/platform-api/src/com/intellij/ui/content/ContentManager.java).
|
||||
|
||||
You can control whether the user is allowed to close tabs either globally or on a per-tab basis.
|
||||
@ -96,12 +96,12 @@ To clarify the above procedure, consider the following fragment of the `plugin.x
|
||||
|
||||
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code_samples](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/) directory of the SDK documentation. This plugin creates the **Sample Calendar** tool window that displays the system date, time and time zone.
|
||||
|
||||
**To run toolWindow plugin**
|
||||
**To run the toolWindow plugin**
|
||||
|
||||
1. Start **IntelliJ IDEA** and open the **tool_window** project saved into the [code_samples/tool_window](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/tool_window) directory.
|
||||
2. Ensure that the project settings are valid for your environment. If necessary, modify the project settings.
|
||||
2. Ensure that the project settings are valid for your environment. If necessary, modify the project settings.
|
||||
To view or modify the project settings, you can open the [Project Structure](https://www.jetbrains.com/help/idea/project-structure-dialog.html) dialog.
|
||||
3. Run the plugin by choosing the **Run | Run** on the main menu.
|
||||
3. Run the plugin by choosing the **Run | Run** on the main menu.
|
||||
If necessary, change the [Run/Debug Configurations](http://www.jetbrains.com/idea/help/run-debug-configuration-plugin.html).
|
||||
|
||||
The plugin creates the **Sample Calendar** tool window. When opened, this tool window is similar to the following screen:
|
||||
|
Loading…
x
Reference in New Issue
Block a user