ide_infrastructure.md: "Context Help"

This commit is contained in:
Yann Cébron 2021-09-15 17:53:25 +02:00
parent 32a3098314
commit ae782b607e
2 changed files with 11 additions and 7 deletions

View File

@ -92,3 +92,7 @@ NOTE: to restrict compatibility, declare [IDEs](plugin_compatibility.md) and [ve
To obtain information about OS and Java VM, use [`SystemInfo`](upsource:///platform/util/src/com/intellij/openapi/util/SystemInfo.java). To obtain information about OS and Java VM, use [`SystemInfo`](upsource:///platform/util/src/com/intellij/openapi/util/SystemInfo.java).
To access relevant configuration directories, see [`PathManager`](upsource:///platform/util/src/com/intellij/openapi/application/PathManager.java). To access relevant configuration directories, see [`PathManager`](upsource:///platform/util/src/com/intellij/openapi/application/PathManager.java).
## Context Help
To show custom context web-based help for your plugin's functionality (e.g., for [dialogs](dialog_wrapper.md)), provide [`WebHelpProvider`](upsource:///platform/platform-api/src/com/intellij/openapi/help/WebHelpProvider.java) registered in `com.intellij.webHelpProvider` extension point.

View File

@ -17,7 +17,7 @@ It provides the following features:
* <shortcut>Left/Right</shortcut> for switching between buttons * <shortcut>Left/Right</shortcut> for switching between buttons
* <shortcut>Y</shortcut>/<shortcut>N</shortcut> for <control>Yes</control>/<control>No</control> actions if they exist in the dialog * <shortcut>Y</shortcut>/<shortcut>N</shortcut> for <control>Yes</control>/<control>No</control> actions if they exist in the dialog
* Optional <control>Do not ask again</control> checkbox * Optional <control>Do not ask again</control> checkbox
### Usage ### Usage
When using the [`DialogWrapper`](upsource:///platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java) class for a dialog, follow these required steps: When using the [`DialogWrapper`](upsource:///platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java) class for a dialog, follow these required steps:
@ -26,19 +26,19 @@ When using the [`DialogWrapper`](upsource:///platform/platform-api/src/com/intel
* Call the `setTitle()` method to set the title for the dialog * Call the `setTitle()` method to set the title for the dialog
* Call the `init()` method from the constructor of the dialog class * Call the `init()` method from the constructor of the dialog class
* Implement the `createCenterPanel()` method to return the component comprising the main contents of the dialog. * Implement the `createCenterPanel()` method to return the component comprising the main contents of the dialog.
Optionally: Optionally:
* Override the `getPreferredFocusedComponent()` method and return the component that should be focused when the dialog is first displayed. * Override the `getPreferredFocusedComponent()` method and return the component that should be focused when the dialog is first displayed.
* Override the `getDimensionServiceKey()` method to return the identifier which will be used for persisting the dialog dimensions. * Override the `getDimensionServiceKey()` method to return the identifier which will be used for persisting the dialog dimensions.
* Override the `getHelpId()` method to return the context help topic associated with the dialog. * Override the `getHelpId()` method to return the context help topic associated with the dialog (see [Context Help](ide_infrastructure.md#context-help)).
The `DialogWrapper` class is often used together with [GUI Designer forms](https://www.jetbrains.com/help/idea/gui-designer-basics.html). The `DialogWrapper` class is often used together with [GUI Designer forms](https://www.jetbrains.com/help/idea/gui-designer-basics.html).
In this case, bind a GUI Designer form to the class extending `DialogWrapper`, bind the top-level panel of the form to a field and return that field from the `createCenterPanel()` method. In this case, bind a GUI Designer form to the class extending `DialogWrapper`, bind the top-level panel of the form to a field and return that field from the `createCenterPanel()` method.
When using Kotlin, use [Kotlin UI DSL](kotlin_ui_dsl.md) to provide the dialog's contents. When using Kotlin, use [Kotlin UI DSL](kotlin_ui_dsl.md) to provide the dialog's contents.
> See [Layout](https://jetbrains.design/intellij/principles/layout) topic in IntelliJ Platform UI Guidelines for recommendations on arranging UI controls in dialogs. > See [Layout](https://jetbrains.design/intellij/principles/layout) topic in IntelliJ Platform UI Guidelines for recommendations on arranging UI controls in dialogs.
> >
> Existing dialogs can be inspected at runtime using [UI Inspector](internal_ui_inspector.md), e.g., to locate the underlying implementation of UI components. > Existing dialogs can be inspected at runtime using [UI Inspector](internal_ui_inspector.md), e.g., to locate the underlying implementation of UI components.
> >
{type="tip"} {type="tip"}
@ -50,7 +50,7 @@ To customize the buttons displayed in the dialog (replacing the standard <contro
Both of these methods return an array of Swing Action objects. Both of these methods return an array of Swing Action objects.
If a button closes the dialog, use [`DialogWrapperExitAction`](upsource:///platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java) as the base class for the action. If a button closes the dialog, use [`DialogWrapperExitAction`](upsource:///platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java) as the base class for the action.
Use `action.putValue(DialogWrapper.DEFAULT_ACTION, true)` to set the default button. Use `action.putValue(DialogWrapper.DEFAULT_ACTION, true)` to set the default button.
### Input Validation ### Input Validation
Please see also [Validation errors](https://jetbrains.design/intellij/principles/validation_errors/) topic in the IntelliJ Platform UI Guidelines. Please see also [Validation errors](https://jetbrains.design/intellij/principles/validation_errors/) topic in the IntelliJ Platform UI Guidelines.
@ -97,4 +97,4 @@ testButton.addActionListener(actionEvent -> {
// user pressed OK // user pressed OK
} }
}); });
``` ```