mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
[docs] formatting
This commit is contained in:
parent
51187bb7a1
commit
5b810fdc86
@ -23,7 +23,7 @@ different parts of the IDE behavior.
|
||||
|
||||
> **TIP** Auto-completion, Quick Documentation and other code insight features are available on extension point tags and attributes.
|
||||
|
||||
1. Add an `<extensions>` element to your plugin.xml if it's not yet present there. Set the `defaultExtensionNs` attribute to one of the following values:
|
||||
1. Add an `<extensions>` element to your `plugin.xml` if it's not yet present there. Set the `defaultExtensionNs` attribute to one of the following values:
|
||||
* `com.intellij`, if your plugin extends the IntelliJ Platform core functionality.
|
||||
* `{ID of a plugin}`, if your plugin extends a functionality of another plugin.
|
||||
2. Add a new child element to the `<extensions>` element. The child element name must match the name of the extension point you want the extension to access.
|
||||
|
@ -24,7 +24,7 @@ Select a [version](https://plugins.jetbrains.com/plugin/9568-go/versions) of the
|
||||
|
||||
The dependency on the Go plugin APIs must be declared in the `plugin.xml` file.
|
||||
As described in [Modules Specific to Functionality](/basics/getting_started/plugin_compatibility.md#modules-specific-to-functionality) table, the `<depends>` tags must declare `com.intellij.modules.go`.
|
||||
The plugin.xml file must also declare a dependency on `com.intellij.modules.platform` as explained in [Configuring the plugin.xml File](dev_alternate_products.md#configuring-pluginxml).
|
||||
The `plugin.xml` file must also declare a dependency on `com.intellij.modules.platform` as explained in [Configuring the plugin.xml File](dev_alternate_products.md#configuring-pluginxml).
|
||||
The dependency declaration is illustrated in the `plugin.xml` snippet below:
|
||||
```xml
|
||||
<!-- Requires the Go plugin -->
|
||||
|
@ -35,7 +35,7 @@ for
|
||||
The code intentions for custom languages also use the regular API for intentions.
|
||||
The intention classes need to implement the
|
||||
[`IntentionAction`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionAction.java)
|
||||
interface and to be registered using the `com.intellij.intentionAction` extension point in your *plugin.xml*.
|
||||
interface and are registered using the `com.intellij.intentionAction` extension point in `plugin.xml`.
|
||||
|
||||
**Examples:**
|
||||
- A [simple intention action](upsource:///plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/control/SplitIfIntention.java) for Groovy
|
||||
|
@ -47,7 +47,7 @@ The good thing is that we can separate project parsing and management here. That
|
||||
|
||||
## Importing from external model
|
||||
|
||||
IntelliJ platform provides standard API for that. Namely, [`ProjectImportBuilder`](upsource:///java/idea-ui/src/com/intellij/projectImport/ProjectImportBuilder.java) and [`ProjectImportProvider`](upsource:///java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java). There are two classes built on *template method* pattern - [`AbstractExternalProjectImportBuilder`](upsource:///java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java) and [`AbstractExternalProjectImportProvider`](upsource:///java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportProvider.java). They might be sub-classes and that concrete implementations should be registered at IoC descriptor (plugin.xml).
|
||||
IntelliJ platform provides standard API for that. Namely, [`ProjectImportBuilder`](upsource:///java/idea-ui/src/com/intellij/projectImport/ProjectImportBuilder.java) and [`ProjectImportProvider`](upsource:///java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java). There are two classes built on *template method* pattern - [`AbstractExternalProjectImportBuilder`](upsource:///java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java) and [`AbstractExternalProjectImportProvider`](upsource:///java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportProvider.java). Concrete implementations are registered in `plugin.xml`.
|
||||
|
||||
Here is an example from the gradle integration plugin:
|
||||
|
||||
|
@ -35,7 +35,7 @@ See [Registering Actions in plugin.xml](/basics/action_system.md#registering-act
|
||||
### Binding Action Groups to UI Components
|
||||
The following sample shows how to use an `<add-to-group>` element to place a custom action group relative to an entry in the **Tools** menu.
|
||||
The attribute `relative-to-action` references the action `id` for `PopupDialogAction`, which is not a native IntelliJ menu entry.
|
||||
Rather `PopupDialogAction` is defined in the same [plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml) file.
|
||||
Rather `PopupDialogAction` is defined in the same [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml) file.
|
||||
This group is placed after the single entry for the action `PopupDialogAction`, as defined in the tutorial [Creating Actions](working_with_custom_actions.md#registering-an-action-with-the-new-action-form).
|
||||
|
||||
```xml
|
||||
@ -94,7 +94,7 @@ to create the `CustomDefaultActionGroup` class in the `action_basics` code sampl
|
||||
```
|
||||
|
||||
### Registering the Custom Action Group
|
||||
As in the case with the static action group, the action `<group>` should be declared in the `<actions>` section of the`plugin.xml` file, for example, the [action_basics](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml) plugin.
|
||||
As in the case with the static action group, the action `<group>` should be declared in the `<actions>` section of the `plugin.xml` file, for example, the [action_basics](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml) plugin.
|
||||
The declaration below shows:
|
||||
* The presence of the `class` attribute in the `<group>` element, which tells the IntelliJ Platform framework to use `CustomDefaultActionGroup` rather than the default implementation.
|
||||
* Setting the group's `popup` attribute to allow submenus.
|
||||
@ -160,7 +160,7 @@ public class DynamicActionGroup extends ActionGroup {
|
||||
```
|
||||
|
||||
### Registering a Variable Action Group
|
||||
To register the dynamic menu group, a `<group>` attribute needs to be placed in the `<actions>` section of [plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml).
|
||||
To register the dynamic menu group, a `<group>` attribute needs to be placed in the `<actions>` section of [`plugin`.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/action_basics/src/main/resources/META-INF/plugin.xml).
|
||||
When enabled, this group appears at the entry just below the [Static Grouped Actions](#binding-action-groups-to-ui-components) in the **Tools** menu:
|
||||
```xml
|
||||
<group id="org.intellij.sdk.action.DynamicActionGroup" class="org.intellij.sdk.action.DynamicActionGroup" popup="true"
|
||||
|
@ -91,7 +91,7 @@ The Gradle version is in defined in a project's `gradle-wrapper.properties`.
|
||||
### Patching the Plugin Configuration File
|
||||
A plugin project's `plugin.xml` file has element values that are "patched" at build time from the attributes of the `patchPluginXml` ([Patching DSL](https://github.com/JetBrains/gradle-intellij-plugin#patching-dsl)) task.
|
||||
As many as possible of the attributes in the Patching DSL will be substituted into the corresponding element values in a plugin project's `plugin.xml` file:
|
||||
* If a `patchPluginXml` attribute default value is defined, the attribute value will be patched in plugin.xml _regardless of whether the `patchPluginXml` task appears in the `build.gradle` file_.
|
||||
* If a `patchPluginXml` attribute default value is defined, the attribute value will be patched in `plugin.xml` _regardless of whether the `patchPluginXml` task appears in the `build.gradle` file_.
|
||||
* For example, the default values for the attributes `patchPluginXml.sinceBuild` and `patchPluginXml.untilBuild` are defined based on the declared (or default) value of `intellij.version`.
|
||||
So by default `patchPluginXml.sinceBuild` and `patchPluginXml.untilBuild` are substituted into the `<idea-version>` element's `since-build` and `until-build` attributes in the `plugin.xml` file.
|
||||
* If a `patchPluginXml` attribute value is explicitly defined, the attribute value will be substituted in `plugin.xml`.
|
||||
|
@ -47,7 +47,7 @@ The user can apply a quick fix to change `a==b` to `a.equals(b)`, or `a!=b` to `
|
||||
The details of the `comparing_references_inspection` implementation illustrate the components of an inspection plugin.
|
||||
|
||||
### Plugin Configuration File
|
||||
The `comparing_references_inspection` is described as a `<localInspection>` type within the `<extensions>` elements in the `comparing_references_inspection` plugin configuration ([plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/comparing_references_inspection/src/main/resources/META-INF/plugin.xml)) file.
|
||||
The `comparing_references_inspection` is described as a `<localInspection>` type within the `<extensions>` elements in the `comparing_references_inspection` plugin configuration ([`plugin.xml`](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/comparing_references_inspection/src/main/resources/META-INF/plugin.xml)) file.
|
||||
Under the hood, inspection types are described as an `<extensionPoint>` in [`LangExtensionPoints.xml`](upsource:///platform/platform-resources/src/META-INF/LangExtensionPoints.xml):
|
||||
* The `localInspection` type is used for inspections that operate on one file at a time, and also operate as the user edits the file.
|
||||
* The `globalInspection` type is used for inspections that operate across multiple files, and the associated fix might, for example, refactor code between files.
|
||||
|
@ -25,7 +25,7 @@ The `editor_basics` code sample adds an **Editor Add Caret** menu item to the ed
|
||||
The source code for the Java action class is [EditorHandlerIllustration](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/editor_basics/src/main/java/org/intellij/sdk/editor/EditorHandlerIllustration.java), a subclass of `AnAction`.
|
||||
For more information about creating action classes, see the [Actions Tutorial](/tutorials/action_system.md) which covers the topic in depth.
|
||||
|
||||
The `EditorHandlerIllustration` action is registered in the `editor_basic` [plugin.xml](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/editor_basics/src/main/resources/META-INF/plugin.xml) file.
|
||||
The `EditorHandlerIllustration` action is registered in the _editor_basic_ [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/editor_basics/src/main/resources/META-INF/plugin.xml) file.
|
||||
Note that this action class is registered to appear on the Editor context menu.
|
||||
```xml
|
||||
<actions>
|
||||
|
Loading…
x
Reference in New Issue
Block a user