mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-01-20 15:49:23 +00:00
Compose setup
This commit is contained in:
parent
3bc8732088
commit
ea305cb70a
@ -5,6 +5,7 @@
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
@ -9,6 +9,7 @@ plugins {
|
||||
alias(libs.plugins.changelog) // Gradle Changelog Plugin
|
||||
alias(libs.plugins.qodana) // Gradle Qodana Plugin
|
||||
alias(libs.plugins.kover) // Gradle Kover Plugin
|
||||
alias(libs.plugins.composeCompiler) // Gradle Compose Compiler Plugin
|
||||
}
|
||||
|
||||
group = providers.gradleProperty("pluginGroup").get()
|
||||
@ -38,6 +39,21 @@ dependencies {
|
||||
intellijPlatform {
|
||||
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
|
||||
|
||||
// Compose support dependencies
|
||||
bundledModules(
|
||||
"intellij.libraries.skiko",
|
||||
"intellij.libraries.compose.foundation.desktop",
|
||||
"intellij.platform.jewel.foundation",
|
||||
"intellij.platform.jewel.ui",
|
||||
"intellij.platform.jewel.ideLafBridge",
|
||||
"intellij.platform.jewel.markdown.core",
|
||||
"intellij.platform.jewel.markdown.ideLafBridgeStyling",
|
||||
"intellij.platform.jewel.markdown.extensions.gfmTables",
|
||||
"intellij.platform.jewel.markdown.extensions.gfmStrikethrough",
|
||||
"intellij.platform.jewel.markdown.extensions.gfmAlerts",
|
||||
//"intellij.platform.jewel.markdown.extensions.autolink", // Not available in 2025.1.1
|
||||
)
|
||||
|
||||
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
|
||||
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@ pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-temp
|
||||
pluginVersion = 2.1.0
|
||||
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild = 242
|
||||
pluginSinceBuild = 251
|
||||
pluginUntilBuild = 252.*
|
||||
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
platformType = IC
|
||||
platformVersion = 2024.2.5
|
||||
platformVersion = 2025.1.1
|
||||
|
||||
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
|
||||
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
|
||||
|
||||
@ -20,3 +20,4 @@ intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "inte
|
||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
|
||||
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
|
||||
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
@ -1,5 +1,19 @@
|
||||
package org.jetbrains.plugins.template.toolWindow
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
@ -8,6 +22,9 @@ import com.intellij.openapi.wm.ToolWindowFactory
|
||||
import com.intellij.ui.components.JBLabel
|
||||
import com.intellij.ui.components.JBPanel
|
||||
import com.intellij.ui.content.ContentFactory
|
||||
import org.jetbrains.jewel.bridge.JewelComposePanel
|
||||
import org.jetbrains.jewel.ui.component.DefaultButton
|
||||
import org.jetbrains.jewel.ui.component.Text
|
||||
import org.jetbrains.plugins.template.MyBundle
|
||||
import org.jetbrains.plugins.template.services.MyProjectService
|
||||
import javax.swing.JButton
|
||||
@ -31,15 +48,17 @@ class MyToolWindowFactory : ToolWindowFactory {
|
||||
|
||||
private val service = toolWindow.project.service<MyProjectService>()
|
||||
|
||||
fun getContent() = JBPanel<JBPanel<*>>().apply {
|
||||
val label = JBLabel(MyBundle.message("randomLabel", "?"))
|
||||
|
||||
add(label)
|
||||
add(JButton(MyBundle.message("shuffle")).apply {
|
||||
addActionListener {
|
||||
label.text = MyBundle.message("randomLabel", service.getRandomNumber())
|
||||
fun getContent() = JewelComposePanel {
|
||||
Column(Modifier.fillMaxWidth().padding(16.dp)) {
|
||||
var param by remember { mutableStateOf("?") }
|
||||
Text(MyBundle.message("randomLabel", param))
|
||||
Spacer(Modifier.height(8.dp))
|
||||
DefaultButton(onClick = {
|
||||
param = service.getRandomNumber().toString()
|
||||
}) {
|
||||
Text(MyBundle.message("shuffle"))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,18 @@
|
||||
<name>IntelliJ Platform Plugin Template</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<dependencies>
|
||||
<module name="intellij.libraries.skiko"></module>
|
||||
<module name="intellij.libraries.compose.foundation.desktop"></module>
|
||||
<module name="intellij.platform.jewel.foundation"></module>
|
||||
<module name="intellij.platform.jewel.ui"></module>
|
||||
<module name="intellij.platform.jewel.ideLafBridge"></module>
|
||||
<module name="intellij.platform.jewel.markdown.core"></module>
|
||||
<module name="intellij.platform.jewel.markdown.ideLafBridgeStyling"></module>
|
||||
<module name="intellij.platform.jewel.markdown.extensions.gfmTables"></module>
|
||||
<module name="intellij.platform.jewel.markdown.extensions.gfmStrikethrough"></module>
|
||||
<module name="intellij.platform.jewel.markdown.extensions.gfmAlerts"></module>
|
||||
</dependencies>
|
||||
|
||||
<resource-bundle>messages.MyBundle</resource-bundle>
|
||||
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
projectService=Project service: {0}
|
||||
randomLabel=The random number is: {0}
|
||||
shuffle=Shuffle
|
||||
helloWorld=Hello world #{0}
|
||||
increment=Moar
|
||||
action.dev.sebastiano.jewel.ijplugin.demo.text=Jewel Demo Dialog
|
||||
Loading…
Reference in New Issue
Block a user