mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 14:21:55 +00:00
cleanup (rename bundle, drop irrelevant showcase code)
This commit is contained in:
parent
ea305cb70a
commit
e901750938
@ -5,9 +5,9 @@ import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
@NonNls
|
||||
private const val BUNDLE = "messages.MyBundle"
|
||||
private const val BUNDLE = "messages.ComposeTemplate"
|
||||
|
||||
object MyBundle : DynamicBundle(BUNDLE) {
|
||||
object ComposeTemplateBundle : DynamicBundle(BUNDLE) {
|
||||
|
||||
@JvmStatic
|
||||
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
|
||||
@ -1,17 +1,8 @@
|
||||
package org.jetbrains.plugins.template.services
|
||||
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.plugins.template.MyBundle
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class MyProjectService(project: Project) {
|
||||
|
||||
init {
|
||||
thisLogger().info(MyBundle.message("projectService", project.name))
|
||||
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
|
||||
}
|
||||
|
||||
@Service
|
||||
class MyProjectService() {
|
||||
fun getRandomNumber() = (1..100).random()
|
||||
}
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
package org.jetbrains.plugins.template.startup
|
||||
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
|
||||
class MyProjectActivity : ProjectActivity {
|
||||
|
||||
override suspend fun execute(project: Project) {
|
||||
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,11 @@
|
||||
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
|
||||
@ -19,15 +16,12 @@ import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.wm.ToolWindow
|
||||
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.ComposeTemplateBundle
|
||||
import org.jetbrains.plugins.template.services.MyProjectService
|
||||
import javax.swing.JButton
|
||||
|
||||
|
||||
class MyToolWindowFactory : ToolWindowFactory {
|
||||
@ -51,12 +45,12 @@ class MyToolWindowFactory : ToolWindowFactory {
|
||||
fun getContent() = JewelComposePanel {
|
||||
Column(Modifier.fillMaxWidth().padding(16.dp)) {
|
||||
var param by remember { mutableStateOf("?") }
|
||||
Text(MyBundle.message("randomLabel", param))
|
||||
Text(ComposeTemplateBundle.message("randomLabel", param))
|
||||
Spacer(Modifier.height(8.dp))
|
||||
DefaultButton(onClick = {
|
||||
param = service.getRandomNumber().toString()
|
||||
}) {
|
||||
Text(MyBundle.message("shuffle"))
|
||||
Text(ComposeTemplateBundle.message("shuffle"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.plugins.template</id>
|
||||
<name>IntelliJ Platform Plugin Template</name>
|
||||
<id>org.jetbrains.plugins.compose.template</id>
|
||||
<name>Compose Template Example</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
|
||||
<dependencies>
|
||||
@ -21,6 +21,5 @@
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<toolWindow factoryClass="org.jetbrains.plugins.template.toolWindow.MyToolWindowFactory" id="MyToolWindow"/>
|
||||
<postStartupActivity implementation="org.jetbrains.plugins.template.startup.MyProjectActivity" />
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user