mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
language tutorial: remove obsolete SimpleFileTypeFactory approach
This commit is contained in:
parent
c59436cb1f
commit
421f176f06
@ -1,23 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileTypeConsumer;
|
||||
import com.intellij.openapi.fileTypes.FileTypeFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* TODO: This class is only used with the {@code com.intellij.fileTypeFactory} extension point
|
||||
* for versions of the IntelliJ Platform prior to v2019.2.
|
||||
*
|
||||
* @see <a href="https://plugins.jetbrains.com/docs/intellij/language-and-filetype.html#register-the-filetype">Custom Language Tutorial</a>
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SimpleFileTypeFactory extends FileTypeFactory {
|
||||
|
||||
@Override
|
||||
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
|
||||
fileTypeConsumer.consume(SimpleFileType.INSTANCE);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
|
||||
|
||||
<idea-plugin>
|
||||
@ -39,13 +39,6 @@
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<fileType name="Simple File" implementationClass="org.intellij.sdk.language.SimpleFileType" fieldName="INSTANCE"
|
||||
language="Simple" extensions="simple"/>
|
||||
<!--
|
||||
Only required for versions of the IntelliJ Platform prior to v2019.2.
|
||||
Use 'com.intellij.fileTypeFactory' extension point INSTEAD of above 'com.intellij.fileType'.
|
||||
See https://plugins.jetbrains.com/docs/intellij/language-and-filetype.html#register-the-filetype for details.
|
||||
|
||||
<fileTypeFactory implementation="org.intellij.sdk.language.SimpleFileTypeFactory"/>
|
||||
-->
|
||||
<lang.parserDefinition language="Simple" implementationClass="org.intellij.sdk.language.SimpleParserDefinition"/>
|
||||
<lang.syntaxHighlighterFactory language="Simple"
|
||||
implementationClass="org.intellij.sdk.language.SimpleSyntaxHighlighterFactory"/>
|
||||
|
@ -52,10 +52,6 @@ The [`SimpleFileType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org
|
||||
|
||||
## Register the FileType
|
||||
|
||||
<tabs>
|
||||
|
||||
<tab title="2019.2 and later">
|
||||
|
||||
The Simple Language file type is registered via the `com.intellij.fileType` extension point in <path>[plugin.xml](plugin_configuration_file.md)</path> and registered with <path>*.simple</path> extension:
|
||||
|
||||
```xml
|
||||
@ -69,38 +65,6 @@ The Simple Language file type is registered via the `com.intellij.fileType` exte
|
||||
</extensions>
|
||||
```
|
||||
|
||||
</tab>
|
||||
|
||||
<tab title="Pre-2019.2">
|
||||
|
||||
> The FileType Factory approach is deprecated. Use it only when the plugin requires support for platform versions older than 2019.2.
|
||||
>
|
||||
{style="warning"}
|
||||
|
||||
**Define a FileType Factory**
|
||||
|
||||
First, define [`SimpleFileTypeFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileTypeFactory.java)
|
||||
as a subclass of [`FileTypeFactory`](%gh-ic%/platform/ide-core/src/com/intellij/openapi/fileTypes/FileTypeFactory.java).
|
||||
|
||||
```java
|
||||
```
|
||||
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileTypeFactory.java"}
|
||||
|
||||
**Register the FileType Factory**
|
||||
|
||||
The `SimpleFileTypeFactory` is registered using the `com.intellij.fileTypeFactory` extension point in <path>plugin.xml</path>.
|
||||
|
||||
```xml
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<fileTypeFactory
|
||||
implementation="org.intellij.sdk.language.SimpleFileTypeFactory"/>
|
||||
</extensions>
|
||||
```
|
||||
|
||||
</tab>
|
||||
|
||||
</tabs>
|
||||
|
||||
## Run the Project
|
||||
|
||||
Run the plugin by using the Gradle [`runIde`](creating_plugin_project.md#running-a-plugin-with-the-runide-gradle-task) task.
|
||||
|
Loading…
x
Reference in New Issue
Block a user