mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 02:07:50 +08:00
Add Kotlin code sample
This commit is contained in:
parent
583e331206
commit
87ee6b5c8d
12
kotlin_demo/kotlin_demo.iml
Normal file
12
kotlin_demo/kotlin_demo.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PLUGIN_MODULE" version="4">
|
||||||
|
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
38
kotlin_demo/resources/META-INF/plugin.xml
Normal file
38
kotlin_demo/resources/META-INF/plugin.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<idea-plugin version="2">
|
||||||
|
<id>org.jetbrains</id>
|
||||||
|
<name>kotlin_demo</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<vendor email="support@yourcompany.com" url="http://www.yourcompany.com">YourCompany</vendor>
|
||||||
|
|
||||||
|
<description><![CDATA[
|
||||||
|
Enter short description for your plugin here.<br>
|
||||||
|
<em>most HTML tags may be used</em>
|
||||||
|
]]></description>
|
||||||
|
|
||||||
|
<change-notes><![CDATA[
|
||||||
|
Add change notes here.<br>
|
||||||
|
<em>most HTML tags may be used</em>
|
||||||
|
]]>
|
||||||
|
</change-notes>
|
||||||
|
|
||||||
|
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
|
||||||
|
<idea-version since-build="141.0"/>
|
||||||
|
|
||||||
|
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
|
||||||
|
on how to target different products -->
|
||||||
|
<!-- uncomment to enable plugin in all products
|
||||||
|
<depends>com.intellij.modules.lang</depends>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<!-- Add your extensions here -->
|
||||||
|
</extensions>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<group id="MyPlugin.TestMeu" text="Greeting" description="Greeting menu">
|
||||||
|
<add-to-group group-id="MainMenu" anchor="last" />
|
||||||
|
<action id="Myplugin.Textboxes" class="HelloAction" text="Hello" description="Says hello" />
|
||||||
|
</group>
|
||||||
|
</actions>
|
||||||
|
|
||||||
|
</idea-plugin>
|
11
kotlin_demo/src/HelloAction.kt
Normal file
11
kotlin_demo/src/HelloAction.kt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
|
import com.intellij.openapi.ui.Messages
|
||||||
|
|
||||||
|
class HelloAction : AnAction("Hello") {
|
||||||
|
override fun actionPerformed(event: AnActionEvent) {
|
||||||
|
val project = event.getData(PlatformDataKeys.PROJECT)
|
||||||
|
Messages.showMessageDialog(project, "Hello from Kotlin!", "Greeting", Messages.getInformationIcon())
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user