mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 10:17:50 +08:00
Doc extender
This commit is contained in:
parent
fc819a4f3c
commit
d59e0e9e97
@ -99,14 +99,15 @@ Consequently, Java dependencies are expressed differently in `plugin.xml` depend
|
||||
|
||||
## Exploring Module and Plugin APIs
|
||||
Once the [dependency on a module or plugin](/basics/plugin_structure/plugin_dependencies.md#) is declared in `plugin.xml`, it's useful to explore the packages and classes available in that dependency.
|
||||
The section below gives some recommended procedures for discovering what's available in a module or plugin.
|
||||
These procedures assume a plugin project has the `build.gradle` and `plugin.xml` dependencies configured correctly.
|
||||
The section below gives some recommended procedures for discovering what's available in a module or plugin on which a project depends.
|
||||
These procedures assume a project has the `build.gradle` and `plugin.xml` dependencies configured correctly.
|
||||
|
||||
### Exploring APIs as a Consumer
|
||||
Exploring the available packages and classes in a plugin or module utilizes features in the IntelliJ IDEA IDE.
|
||||
|
||||
If the project is not up to date, [Reimport the Gradle project](https://www.jetbrains.com/help/idea/work-with-gradle-projects.html#gradle_refresh_project) as a first step.
|
||||
Reimporting the project will automatically update the dependencies.
|
||||
|
||||
In the Project Window, select Project View and scroll to the bottom to see [External Libraries](https://www.jetbrains.com/help/idea/project-tool-window.html#content_pane).
|
||||
Look for the library `Gradle:unzipped.com.jetbrains.plugins:foo:`, where "foo" matches, or is similar to, the contents of the `<depends>` tags in `plugin.xml` or the `intellij.plugins` declaration in `build.gradle`.
|
||||
The image below shows the External Libraries for the example plugin project configuration explained in [Configuring build.gradle](/products/dev_alternate_products.md#configuring-buildgradle-using-the-intellij-idea-product-attribute) and [Configuring plugin.xml](/products/dev_alternate_products.md#configuring-pluginxml).
|
||||
@ -116,6 +117,19 @@ The image below shows the External Libraries for the example plugin project conf
|
||||
Expand the External Library (as shown) to reveal the JAR files contained in the library.
|
||||
Drill down into the JAR files to expose the packages and (decompiled) classes.
|
||||
|
||||
### Exploring APIs as an Extender
|
||||
If a project is dependent on a plugin or module, in some cases the project can also [extend](/basics/plugin_structure/plugin_extensions_and_extension_points.md) the functionality available from the plugin or module.
|
||||
|
||||
To browse the opportunities for extension, start by placing the cursor on the contents of the `<depends>` elements in the project's `plugin.xml` file.
|
||||
Use the [Go to Declaration](https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#go_to_declaration) IDE feature to navigate to the `plugin.xml` file for the plugin on which the project depends.
|
||||
|
||||
For example, performing this procedure on the `<depends>com.jetbrains.php</depends>` declaration in a project's `plugin.xml` file will navigate to the `plugin.xml` file for the `com.jetbrains.php` (PHP) project.
|
||||
A common, but not universal, pattern in the IntelliJ platform is for a plugin (like PHP) to declare `<extensionPoints>` and then implement each one as `<extensions>`.
|
||||
Continuing the example, search the PHP plugin's `plugin.xml` file for:
|
||||
* `<extensionPoints>` to find the opportunities for extending the PHP plugin's functionality.
|
||||
* `<extensions defaultExtensionNs="com.jetbrains.php">` to find where the PHP plugin extends functionality.
|
||||
The extension namespace (in this example `com.jetbrains.php`) will match the `<id>` defined in the `plugin.xml` file.
|
||||
|
||||
|
||||
## Verifying Dependency
|
||||
Before marking a plugin project as _dependent only on modules in a target product_ in addition to `com.intellij.modules.platform`, verify the plugin isn't implicitly dependent on any APIs that are specific to IntelliJ IDEA.
|
||||
|
Loading…
x
Reference in New Issue
Block a user