### UI Test Example Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md An example of a UI test using the IntelliJ UI Test Robot to interact with IDE components. Ensure the robot-server is running and accessible at http://localhost:8082. ```kotlin class MyUITest { @Test fun openAboutFromWelcomeScreen() { val robot = RemoteRobot("http://127.0.0.1:8082") robot.find(byXpath("//div[@myactionlink = 'gearHover.svg']")).click() // ... } } ``` -------------------------------- ### Changelog Structure Example Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Example of a changelog file structure, including sections for unreleased changes and specific versions. This format is automatically managed by the Gradle Changelog Plugin. ```markdown # YourPlugin Changelog ## [Unreleased] ## [0.0.1] ### Added - An awesome feature - Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template) ### Fixed - One annoying bug ``` -------------------------------- ### Get Changelog Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Retrieve the changelog for the current version of your plugin. Use --unreleased to get unreleased changes and --no-header to omit the header. ```bash ./gradlew getChangelog --unreleased --no-header ``` -------------------------------- ### Startup Activity Implementation (Kotlin) Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Defines a project activity that executes asynchronously upon project opening. Suitable for one-time initialization tasks per project. ```kotlin 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().info("Project ${project.name} opened, performing initialization...") // Initialize plugin state, register listeners, etc. } } ``` -------------------------------- ### Initialize Changelog File Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md The initial structure for the project changelog file. ```markdown # YourPlugin Changelog ## [Unreleased] ``` -------------------------------- ### Execute Gradle Commands Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Common CLI tasks for building, testing, and running the plugin. ```bash # Build the plugin distribution ./gradlew buildPlugin # Run tests ./gradlew check # Run the plugin in a sandboxed IDE instance ./gradlew runIde # Verify plugin compatibility ./gradlew verifyPlugin # Run UI tests (requires IDE instance) ./gradlew runIdeForUiTests ``` -------------------------------- ### Java and Kotlin Source Directories Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Demonstrates how to configure project structure for Java and Kotlin development. By default, Kotlin is used, but Java can be added by creating a `/src/main/java` directory. ```java // Initially, the /src/main/kotlin directory is available with minimal examples. You can still replace it or add the /src/main/java directory to start working with Java language instead. ``` -------------------------------- ### Publish Plugin Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Use this command to publish your plugin to the JetBrains Marketplace. Requires a PUBLISH_TOKEN. ```bash ./gradlew publishPlugin ``` -------------------------------- ### Plugin Configuration (plugin.xml) Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Defines the plugin's identity, dependencies, and extension points. Registers services, tool windows, and startup activities. ```xml org.jetbrains.plugins.template IntelliJ Platform Plugin Template JetBrains com.intellij.modules.platform messages.MyBundle ``` -------------------------------- ### View Project Directory Structure Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Displays the standard file and folder layout for a project generated from the IntelliJ Platform Plugin Template. ```text . ├── .github/ GitHub Actions workflows and Dependabot configuration files ├── .run/ Predefined Run/Debug Configurations ├── build/ Output build directory ├── gradle │ ├── wrapper/ Gradle Wrapper │ └── libs.versions.toml Gradle version catalog ├── src Plugin sources │ ├── main │ │ ├── kotlin/ Kotlin production sources │ │ └── resources/ Resources - plugin.xml, icons, messages │ └── test │ ├── kotlin/ Kotlin test sources │ └── testData/ Test data used by tests ├── .gitignore Git ignoring rules ├── build.gradle.kts Gradle configuration ├── CHANGELOG.md Full change history ├── gradle.properties Gradle configuration properties ├── gradlew *nix Gradle Wrapper script ├── gradlew.bat Windows Gradle Wrapper script ├── LICENSE License, MIT by default ├── qodana.yml Qodana configuration file ├── README.md README └── settings.gradle.kts Gradle project settings ``` -------------------------------- ### Configure Gradle Properties Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Sets project-level metadata, target platform versions, and build optimization flags. ```properties # gradle.properties group = org.jetbrains.plugins.template version = 2.5.0 pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-template # Opt-out flag for bundling Kotlin standard library kotlin.stdlib.default.dependency = false # Enable Gradle Configuration Cache org.gradle.configuration-cache = true # Enable Gradle Build Cache org.gradle.caching = true ``` -------------------------------- ### Tool Window Factory (Kotlin) Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Provides a factory for creating custom UI panels within the IDE's tool windows. Uses lazy instantiation for tool window content. ```kotlin package org.jetbrains.plugins.template.toolWindow import com.intellij.openapi.components.service 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.plugins.template.MyBundle import org.jetbrains.plugins.template.services.MyProjectService import javax.swing.JButton class MyToolWindowFactory : ToolWindowFactory { override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { val myToolWindow = MyToolWindow(toolWindow) val content = ContentFactory.getInstance().createContent(myToolWindow.getContent(), null, false) toolWindow.contentManager.addContent(content) } override fun shouldBeAvailable(project: Project) = true class MyToolWindow(toolWindow: ToolWindow) { private val service = toolWindow.project.service() fun getContent() = JBPanel>().apply { val label = JBLabel(MyBundle.message("randomLabel", "?")) add(label) add(JButton(MyBundle.message("shuffle")).apply { addActionListener { label.text = MyBundle.message("randomLabel", service.getRandomNumber()) } }) } } } ``` -------------------------------- ### Configure plugin.xml Manifest Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Defines the core plugin configuration including ID, vendor, dependencies, and extension points. ```xml org.jetbrains.plugins.template Template JetBrains com.intellij.modules.platform messages.MyBundle ``` -------------------------------- ### Project Service Implementation (Kotlin) Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Implements a project-scoped service for storing project-specific state or functionality. Automatically instantiated by the IDE when first accessed. ```kotlin 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)) } fun getRandomNumber() = (1..100).random() } // Usage from any component with project access: // val service = project.service() // val number = service.getRandomNumber() ``` -------------------------------- ### Define Dependency in Version Catalog Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Define the version and library coordinates in the libs.versions.toml file. ```toml [versions] annotations = "24.0.1" [libraries] annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } ``` -------------------------------- ### Configure Gradle Build Script Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Configures the IntelliJ Platform Gradle Plugin, changelog generation, and plugin metadata extraction. ```kotlin // build.gradle.kts import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { id("org.jetbrains.kotlin.jvm") id("org.jetbrains.intellij.platform") id("org.jetbrains.changelog") } dependencies { testImplementation("junit:junit:4.13.2") intellijPlatform { intellijIdea("2025.2.6.1") testFramework(TestFrameworkType.Platform) } } intellijPlatform { pluginConfiguration { // Extract description from README.md between markers description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { val start = "" val end = "" with(it.lines()) { subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) } } // Get changelog from CHANGELOG.md val changelog = project.changelog changeNotes = version.map { pluginVersion -> with(changelog) { renderItem( (getOrNull(pluginVersion) ?: getUnreleased()) .withHeader(false) .withEmptySections(false), Changelog.OutputType.HTML, ) } } } } changelog { groups.empty() repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") versionPrefix = "" } ``` -------------------------------- ### Perform Plugin Testing Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Uses BasePlatformTestCase to run functional tests in a headless IDE instance. ```kotlin package org.jetbrains.plugins.template import com.intellij.ide.highlighter.XmlFileType import com.intellij.openapi.components.service import com.intellij.psi.xml.XmlFile import com.intellij.testFramework.TestDataPath import com.intellij.testFramework.fixtures.BasePlatformTestCase import com.intellij.util.PsiErrorElementUtil import org.jetbrains.plugins.template.services.MyProjectService @TestDataPath("$CONTENT_ROOT/src/test/testData") class MyPluginTest : BasePlatformTestCase() { fun testXMLFile() { val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "bar") val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java) assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile)) assertNotNull(xmlFile.rootTag) xmlFile.rootTag?.let { assertEquals("foo", it.name) assertEquals("bar", it.value.text) } } fun testRename() { myFixture.testRename("foo.xml", "foo_after.xml", "a2") } fun testProjectService() { val projectService = project.service() assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber()) } override fun getTestDataPath() = "src/test/testData/rename" } ``` -------------------------------- ### Update Gradle Wrapper Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Update the Gradle version in properties and execute the wrapper task. ```properties gradleVersion = ... ``` ```bash ./gradlew wrapper ``` -------------------------------- ### Update Gradle Wrapper Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt This command updates the Gradle wrapper to the latest version. ```bash ./gradlew wrapper ``` -------------------------------- ### Gradle Changelog Plugin Configuration Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md This snippet is a placeholder for Gradle Changelog Plugin configuration. Refer to the plugin's README for specific configuration details. ```gradle # Configuration for the Gradle Changelog Plugin would go here. # See the [Gradle Changelog Plugin](https://github.com/klimpeltje/gradle-changelog-plugin) README for details. ``` -------------------------------- ### Plugin Publishing Gradle Task Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md The `publishPlugin` task from the `intellij-platform-gradle-plugin` is used for publishing plugins to JetBrains Marketplace. Ensure the `PUBLISH_TOKEN` environment variable is set. ```gradle publishPlugin { token = System.getenv("PUBLISH_TOKEN") } ``` -------------------------------- ### Implement DynamicBundle for Internationalization Source: https://context7.com/jetbrains/intellij-platform-plugin-template/llms.txt Provides type-safe access to localized messages. Requires defining a properties file and using the message or messagePointer methods. ```kotlin package org.jetbrains.plugins.template import com.intellij.DynamicBundle import org.jetbrains.annotations.NonNls import org.jetbrains.annotations.PropertyKey @NonNls private const val BUNDLE = "messages.MyBundle" object MyBundle : DynamicBundle(BUNDLE) { @JvmStatic fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = getMessage(key, *params) @JvmStatic fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = getLazyMessage(key, *params) } // messages/MyBundle.properties: // projectService=Project service: {0} // randomLabel=The random number is: {0} // shuffle=Shuffle // Usage: // MyBundle.message("projectService", project.name) // MyBundle.message("randomLabel", 42) ``` -------------------------------- ### Add Dependency in Gradle Source: https://github.com/jetbrains/intellij-platform-plugin-template/blob/main/README.md Add a new dependency to the project within the dependencies block. ```kotlin dependencies { implementation(libs.annotations) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.