mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 17:57:53 +08:00
Angle brackets in text are now enclosed in code spans
IJSDK-56
This commit is contained in:
parent
4b14c47af3
commit
20f55c386d
@ -35,11 +35,11 @@ The ```AnActionEvent``` instance is also passed to the ```actionPerformed``` met
|
||||
|
||||
## Registering Actions
|
||||
|
||||
There are two main ways to register an action: either by listing it in the \<actions\> section of the plugin.xml file, or through Java code.
|
||||
There are two main ways to register an action: either by listing it in the `<actions>` section of the plugin.xml file, or through Java code.
|
||||
|
||||
### Registering Actions in plugin.xml
|
||||
|
||||
Registering actions in plugin.xml is demonstrated in the following example. The example section of plugin.xml demonstrates all elements which can be used in the \<actions\> section, and describes the meaning of each element.
|
||||
Registering actions in plugin.xml is demonstrated in the following example. The example section of plugin.xml demonstrates all elements which can be used in the `<actions>` section, and describes the meaning of each element.
|
||||
|
||||
```xml
|
||||
<!-- Actions -->
|
||||
@ -149,7 +149,7 @@ public class MyPluginRegistration implements ApplicationComponent {
|
||||
Note, that the sample ```TextBoxes``` class is described in
|
||||
[Getting Started with Plugin Development](/basics/getting_started.html).
|
||||
|
||||
To ensure that your plugin is initialized on IDEA start-up, make the following changes to the \<application-components\> section of the plugin.xml file:
|
||||
To ensure that your plugin is initialized on IDEA start-up, make the following changes to the `<application-components>` section of the plugin.xml file:
|
||||
|
||||
```xml
|
||||
<application-components>
|
||||
|
@ -35,7 +35,7 @@ bean class.
|
||||
To access this extension point, create a Java class that implements the
|
||||
[FileViewProviderFactory](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java)
|
||||
interface, and in this class, override the ```createFileViewProvider``` method.
|
||||
To declare the extension to the _fileType.fileViewProviderFactory_ extension point, to the \<extensions\> section of the plugin.xml file, add the following syntax:
|
||||
To declare the extension to the _fileType.fileViewProviderFactory_ extension point, to the `<extensions>` section of the plugin.xml file, add the following syntax:
|
||||
|
||||
```
|
||||
<fileType.fileViewProviderFactory filetype=%file type% implementationClass=%class name%>
|
||||
|
@ -9,7 +9,7 @@ To deploy a plugin:
|
||||
* Make your project by invoking **Build \| Make Project**.
|
||||
|
||||
* Prepare your plugin for deployment.
|
||||
In the main menu, select **Build \| Prepare Plugin Module \<module name\> for Deployment**.
|
||||
In the main menu, select **Build \| Prepare Plugin Module `<module name>` for Deployment**.
|
||||
|
||||

|
||||
|
||||
|
@ -26,7 +26,7 @@ Refer to it as an example to understand this topic better.
|
||||
|
||||
Each specific index implementation is a class extending
|
||||
[FileBasedIndexExtension](https://github.com/JetBrains/intellij-community/blob/master/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java).
|
||||
A file-base index should be registered in the \<fileBasedIndex\> extension point.
|
||||
A file-base index should be registered in the `<fileBasedIndex>` extension point.
|
||||
|
||||
The implementation of a file-based contains of the following main parts:
|
||||
|
||||
|
@ -43,7 +43,7 @@ The name of a component is returned by its ```getComponentName()``` method.
|
||||
|
||||
### Components Naming Notation
|
||||
|
||||
It is recommended to name components in \<plugin_name\>.\<component_name\> form.
|
||||
It is recommended to name components in `<plugin_name>.<component_name>` form.
|
||||
|
||||
### Application Level Components
|
||||
|
||||
@ -115,7 +115,7 @@ Note that module-level components must be registered in the ```<module-component
|
||||
#### Quick creation of module components
|
||||
|
||||
*IntelliJ IDEA* suggests a simplified way to create module components, with all the required infrastructure.
|
||||
The IDEA interface will help you declare the module component's implementation class, and will automatically make appropriate changes to the \<module-components\> section of the `plugin.xml` file.
|
||||
The IDEA interface will help you declare the module component's implementation class, and will automatically make appropriate changes to the `<module-components>` section of the `plugin.xml` file.
|
||||
|
||||
*To create and register a module component*
|
||||
|
||||
@ -158,9 +158,9 @@ For more information and samples, refer to
|
||||
### Defaults
|
||||
|
||||
|
||||
The defaults (components' predefined settings) should be placed in the *\<component_name\>.xml* file.
|
||||
The defaults (components' predefined settings) should be placed in the `<component_name>.xml` file.
|
||||
Place this file in the plugin's classpath in the folder corresponding to the default package.
|
||||
The ```readExternal()``` method will be called on the \<component\> root tag.
|
||||
The ```readExternal()``` method will be called on the `<component>` root tag.
|
||||
|
||||
If a component has defaults, the ```readExternal()``` method is called twice:
|
||||
|
||||
|
@ -8,11 +8,11 @@ In order to do so, you need to perform the following two steps:
|
||||
* Add the jars of the plugin you're depending on to the classpath of your *IntelliJ Platform SDK*.
|
||||
**Note**: Don't add the plugin jars as a library: this will fail at runtime because IntelliJ Platform will load two separate copies of the dependency plugin classes.
|
||||
|
||||
* Add a \<depends\> tag to your plugin.xml, adding the ID of the plugin you're depending on as the contents of the tag.
|
||||
* Add a `<depends>` tag to your plugin.xml, adding the ID of the plugin you're depending on as the contents of the tag.
|
||||
For example:
|
||||
|
||||
```xml
|
||||
<depends>org.jetbrains.idea.maven</depends>
|
||||
```
|
||||
|
||||
To find out the ID of the plugin you're depending on, locate the META-INF/plugin.xml file inside its jar and check the contents of the \<id\> tag.
|
||||
To find out the ID of the plugin you're depending on, locate the META-INF/plugin.xml file inside its jar and check the contents of the `<id>` tag.
|
||||
|
@ -56,17 +56,17 @@ public class MyBeanClass1 extends AbstractExtensionPointBean {
|
||||
|
||||
}
|
||||
```
|
||||
Note that to declare an extension designed to access the MyExtensionPoint1 extension point, your plugin.xml file must contain the \<MyExtensionPoint1\> tag with the "key" and "implementationClass" attributes set to appropriate values (see the sample plugin.xml file below).
|
||||
Note that to declare an extension designed to access the MyExtensionPoint1 extension point, your plugin.xml file must contain the `<MyExtensionPoint1>` tag with the "key" and "implementationClass" attributes set to appropriate values (see the sample plugin.xml file below).
|
||||
|
||||
*To declare an extension*
|
||||
|
||||
1. For the \<extensions\> element, set the *xmlns* (deprecated) or *defaultExtensionNs* attribute to one of the following values:
|
||||
1. For the `<extensions>` element, set the *xmlns* (deprecated) or *defaultExtensionNs* attribute to one of the following values:
|
||||
|
||||
* _com.intellij_, if your plugin extends the IDEA 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.
|
||||
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.
|
||||
|
||||
3. Depending on the type of the extension point, do one of the following:
|
||||
@ -97,7 +97,7 @@ To clarify this procedure, consider the following sample section of the plugin.x
|
||||
|
||||
## How to Get the Extension Points List?
|
||||
|
||||
To get a list of extension points available in the *IntelliJ Platform* core, consult the _\<extensionPoints\>_ section of the following XML configuration files:
|
||||
To get a list of extension points available in the *IntelliJ Platform* core, consult the `<extensionPoints>` section of the following XML configuration files:
|
||||
|
||||
* [LangExtensionPoints.xml](https://github.com/JetBrains/intellij-community/blob/master/platform/platform-resources/src/META-INF/LangExtensionPoints.xml)
|
||||
|
||||
|
@ -23,7 +23,7 @@ To declare a service, you can use the following extension points in the IDEA cor
|
||||
|
||||
*To declare a service:*
|
||||
|
||||
1. Add the appropriate child element (\<applicationService\>, \<projectService\> or \<moduleService\>) to the \<extensions\> section of the plugin.xml file.
|
||||
1. Add the appropriate child element (`<applicationService>`, `<projectService>` or `<moduleService>`) to the `<extensions>` section of the plugin.xml file.
|
||||
|
||||
2. For the newly added child element, set the following attributes:
|
||||
|
||||
|
@ -35,7 +35,7 @@ A _library_ is an archive of compiled code (such as JAR files) that your modules
|
||||
|
||||
* **Project Library**: the library classes are visible within the project and the library information is recorded in the project \*.ipr file or in _.idea/libraries_.
|
||||
|
||||
* **Global Library**: the library information is recorded in the _applicationLibraries.xml_ file into the \<User Home\>/.IntelliJIdea/config/options_ directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
* **Global Library**: the library information is recorded in the _applicationLibraries.xml_ file into the `<User Home>/.IntelliJIdea/config/options` directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
|
||||
For more information about libraries, refer to
|
||||
[Library](http://www.jetbrains.com/idea/webhelp/library.html).
|
||||
|
@ -127,7 +127,7 @@ In your implementation of ```getRefactoringElementListener()```, you need to che
|
||||
|
||||
Many plugins support automatic creation of run configurations from context, so that the user can click, for example, on an application or test class and automatically run it using the correct run configuration type. In order to support that, you need to provide an implementation of the
|
||||
[RunConfigurationProducer](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/execution/actions/RunConfigurationProducer.java)
|
||||
interface and to register it as \<runConfigurationProducer\> in your plugin.xml.
|
||||
interface and to register it as `<runConfigurationProducer>` in your plugin.xml.
|
||||
(Note that this API has been redesigned in IntelliJ IDEA 13; ```RuntimeConfigurationProducer``` is an older and much more confusing version of the same API).
|
||||
|
||||
The two main methods that you need to implement are:
|
||||
|
@ -32,7 +32,7 @@ IntelliJ IDEA supports three types of libraries:
|
||||
|
||||
* **Module Library**: the library classes are visible only in this module and the library information is recorded in the module *.iml file.
|
||||
* **Project Library**: the library classes are visible within the project and the library information is recorded in the project *.ipr file or in .idea/libraries.
|
||||
* **Global Library**: the library information is recorded in the applicationLibraries.xml file into the \<User Home\>/.IntelliJIdea/config/options directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
* **Global Library**: the library information is recorded in the applicationLibraries.xml file into the `<User Home>/.IntelliJIdea/config/options` directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
|
||||
For more information about libraries, refer to
|
||||
[Library] (http://www.jetbrains.com/idea/webhelp/library.html).
|
||||
|
@ -50,7 +50,7 @@ mechanism to support plugins. There are several service interfaces (e.g. `Builde
|
||||
|
||||
### Registering a plugin for External Builder
|
||||
|
||||
Sources of a plugin for External Builder should be put in a separate module. By convention such module has name '...-jps-plugin' and its sources are placed under 'jps-plugin' directory in the main plugin directory. Use \<compileServer.plugin\> extension to add the plugin to classpath of external build process, the plugin jar should be named \<jps module name\>.jar. 'Build' | 'Prepare Plugin Module for deployment' action will automatically pack 'jps-plugin' part to a separate jar accordingly.
|
||||
Sources of a plugin for External Builder should be put in a separate module. By convention such module has name '...-jps-plugin' and its sources are placed under 'jps-plugin' directory in the main plugin directory. Use `<compileServer.plugin>` extension to add the plugin to classpath of external build process, the plugin jar should be named `<jps module name>.jar`. 'Build' | 'Prepare Plugin Module for deployment' action will automatically pack 'jps-plugin' part to a separate jar accordingly.
|
||||
|
||||
### Debugging a plugin for External Builder
|
||||
|
||||
@ -73,7 +73,7 @@ The build process has built-in self-cpu-profiling capabilities. To enable them d
|
||||
|
||||
3. Make sure automatic make is turned off
|
||||
|
||||
After this every build process run should result in a CPU snapshot stored in \<user-home\>/Snapshots directory.
|
||||
After this every build process run should result in a CPU snapshot stored in `<user-home>`/Snapshots directory.
|
||||
Snapshots are named like "ExternalBuild\-\{date\}.snapshot".
|
||||
|
||||
Specifying `-Dprofiling.mode=false` will turn profiling off.
|
||||
|
@ -7,7 +7,7 @@ IntelliJ IDEA supports three types of libraries:
|
||||
|
||||
* **Module Library**: the library classes are visible only in this module and the library information is recorded in the module *.iml file.
|
||||
* **Project Library**: the library classes are visible within the project and the library information is recorded in the project *.ipr file or in .idea/libraries.
|
||||
* **Global Library**: the library information is recorded in the applicationLibraries.xml file into the \<User Home\>/.IntelliJIdea/config/options directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
* **Global Library**: the library information is recorded in the applicationLibraries.xml file into the `<User Home>/.IntelliJIdea/config/options` directory. Global libraries are similar to project libraries, but are visible for the different projects.
|
||||
|
||||
For more information about libraries, refer to
|
||||
[Library](http://www.jetbrains.com/idea/webhelp/library.html).
|
||||
|
@ -7,7 +7,7 @@ In this case the group will be available as a top-level menu item, action will b
|
||||
|
||||
### 2.1. Creating simple action groups
|
||||
|
||||
Grouping can be done by extending adding *\<group\>* attribute to *\<actions\>*
|
||||
Grouping can be done by extending adding `<group>` attribute to `<actions>`
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/register_actions/META-INF/plugin.xml)
|
||||
file.
|
||||
|
||||
@ -181,7 +181,7 @@ public class BaseActionGroup extends ActionGroup {
|
||||
|
||||
### 2.12. Registering variable action group
|
||||
|
||||
To register the group *\<group\>* attribute needs to be placed in the *\<actions\>* section of
|
||||
To register the group `<group>` attribute needs to be placed in the *`<actions>`* section of
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/register_actions/META-INF/plugin.xml):
|
||||
|
||||
```xml
|
||||
@ -194,7 +194,7 @@ To register the group *\<group\>* attribute needs to be placed in the *\<actions
|
||||
```
|
||||
**Note**: Since the set of actions is defined dynamically no action definitions should be placed in
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/register_actions/META-INF/plugin.xml).
|
||||
If *\<group\>* attribute contains any static action definition an exception will be thrown.
|
||||
If `<group>` attribute contains any static action definition an exception will be thrown.
|
||||
For statically defined group of action use
|
||||
[DefaultActionGroup.java](https://github.com/JetBrains/intellij-community/blob/master/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java)
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class SimpleAction extends AnAction {
|
||||
|
||||
### 1.3. Registering actions
|
||||
|
||||
To register a newly created action, *\<action\>* attribute should be added to the *\<actions\>* section of the plugin configuration file
|
||||
To register a newly created action, `<action>` attribute should be added to the `<actions>` section of the plugin configuration file
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/register_actions/META-INF/plugin.xml).
|
||||
IntelliJ IDEA has an embedded inspection that spots unregistered actions.
|
||||

|
||||
@ -54,7 +54,7 @@ visual position of the menu item the action is bound to, and a shortcut for invo
|
||||
In our case the action will be available in the **Tools Menu**, it will be placed on top, and will have no shortcuts.
|
||||

|
||||
|
||||
After filling the **New Action** form and applying the changes *\<actions\>* section of our
|
||||
After filling the **New Action** form and applying the changes `<actions>` section of our
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/register_actions/META-INF/plugin.xml)
|
||||
file will look like this:
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class EditorIllustration extends AnAction {
|
||||
|
||||
### 1.1.2. Registering an action
|
||||
|
||||
To register the action we should add a corresponding attribute to the *\<actions\>* section of the plugin configuration file
|
||||
To register the action we should add a corresponding attribute to the `<actions>` section of the plugin configuration file
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/editor_basics/resources/META-INF/plugin.xml)
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class DemoFramework extends FrameworkTypeEx {
|
||||
|
||||
## 2. Registering framework
|
||||
|
||||
The newly created framework should be registered as an extension point by putting *framework.type* attribute into *\<extensions\>* section of
|
||||
The newly created framework should be registered as an extension point by putting *framework.type* attribute into `<extensions>` section of
|
||||
[plugin.xml](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/framework/META-INF/plugin.xml)
|
||||
configuration file:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user