mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
new EP <fileType>
This commit is contained in:
parent
d86f1e8fa9
commit
c91f9ff19c
@ -6,6 +6,9 @@ title: Notable Changes in IntelliJ Platform and Plugins API 2019.*
|
||||
|
||||
## Notable Changes in IntelliJ Platform 2019.2
|
||||
|
||||
`com.intellij.openapi.fileTypes.FileTypeFactory` deprecated
|
||||
: When registering file type via file extension matching, use extension point `com.intellij.fileType` instead (see [Sample](/tutorials/custom_language_support/language_and_filetype.md#b-register-file-type-20192-or-later)).
|
||||
|
||||
Unbundled plugins in IntelliJ IDEA
|
||||
: Several plugins for no longer actively maintained technology have been moved to a [separate repository](https://github.com/JetBrains/intellij-obsolete-plugins/). If your plugin depends on them, users will need to install them from the [JetBrains plugin repository](https://plugins.jetbrains.com).
|
||||
|
||||
|
@ -12,7 +12,8 @@ which passes a
|
||||
subclass to its base class constructor.
|
||||
To register a file type, the plugin developer provides a subclass of
|
||||
[FileTypeFactory](upsource:///platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeFactory.java), which is registered via the `com.intellij.fileTypeFactory`
|
||||
[platform extension point](upsource:///platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml).
|
||||
[platform extension point](upsource:///platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml).
|
||||
> **NOTE** When targeting 2019.2 or later only, using `com.intellij.fileType` extension point is preferred to using dedicated `FileTypeFactory`.
|
||||
|
||||
**Example**:
|
||||
[LanguageFileType](upsource:///platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java)
|
||||
|
@ -29,6 +29,8 @@ to **com.simpleplugin.icons** package.
|
||||
|
||||
### 2.4. Define a file type factory
|
||||
|
||||
> **NOTE** When targeting 2019.2 or later only, please see [2.5.B](#b-register-file-type-20192-or-later)
|
||||
|
||||
```java
|
||||
{% include /code_samples/simple_language_plugin/src/com/simpleplugin/SimpleFileTypeFactory.java %}
|
||||
```
|
||||
@ -43,6 +45,17 @@ In plugin.xml add:
|
||||
</extensions>
|
||||
```
|
||||
|
||||
### 2.5.B. Register file type (2019.2 or later)
|
||||
|
||||
Registration of file type can now be done via `plugin.xml` only without implementing `FileTypeFactory` when matching by extension(s) only.
|
||||
|
||||
```xml
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<fileType name="Simple file" implementationClass="com.simpleplugin.SimpleFileType" fieldName="INSTANCE"
|
||||
language="Simple" extensions="simple"/>
|
||||
</extensions>
|
||||
```
|
||||
|
||||
### 2.6. Run the project
|
||||
|
||||
Create a file with extension *.simple*
|
||||
|
Loading…
x
Reference in New Issue
Block a user