### Complete Plugin Integration Test Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_intro.md A comprehensive example of an integration test for an IntelliJ Platform plugin. It sets up the test environment, installs a plugin from a local folder, runs the IDE with a driver, and waits for indicators before closing. ```kotlin class PluginTest { init { di = DI { extend(di) bindSingleton(overrides = true) { object : CIServer by NoCIServer { override fun reportTestFailure( testName: String, message: String, details: String, linkToLogs: String? ) { fail { "$testName fails: $message. \n$details" } } } } } } @Test fun simpleTest() { val result = Starter.newContext( "testExample", TestCase( IdeProductProvider.IC, GitHubProject.fromGithub( branchName = "master", repoRelativeUrl = "JetBrains/ij-perf-report-aggregator" ) ).withVersion("2024.2") ).apply { val pathToPlugin = System.getProperty("path.to.build.plugin") PluginConfigurator(this).installPluginFromFolder(File(pathToPlugin)) }.runIdeWithDriver().useDriverAndCloseIde { waitForIndicators(5.minutes) } } } ``` -------------------------------- ### Minimal LSP Plugin Setup Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/language_server_protocol.md Implement LspServerSupportProvider to register and start an LSP server for specific file types. Ensure the server descriptor is registered as an extension. ```kotlin import com.intellij.platform.lsp.api.LspServerSupportProvider import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor internal class FooLspServerSupportProvider : LspServerSupportProvider { override fun fileOpened(project: Project, file: VirtualFile, serverStarter: LspServerStarter) { if (file.extension == "foo") { serverStarter.ensureServerStarted(FooLspServerDescriptor(project)) } } } private class FooLspServerDescriptor(project: Project) : ProjectWideLspServerDescriptor(project, "Foo") { override fun isSupportedFile(file: VirtualFile) = file.extension == "foo" override fun createCommandLine() = GeneralCommandLine("foo", "--stdio") } ``` -------------------------------- ### Full Integration Test Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_intro.md A complete integration test demonstrating context creation, plugin installation, opening a GitHub project, and IDE lifecycle management. Includes waiting for indicators before closing the IDE. ```kotlin @Test fun simpleTest() { Starter.newContext( "testExample", TestCase( IdeProductProvider.IC, GitHubProject.fromGithub( branchName = "master", repoRelativeUrl = "JetBrains/ij-perf-report-aggregator" ) ).withVersion("2024.2") ).apply { val pathToPlugin = System.getProperty("path.to.build.plugin") PluginConfigurator(this).installPluginFromFolder(File(pathToPlugin)) }.runIdeWithDriver().useDriverAndCloseIde { waitForIndicators(5.minutes) } } ``` -------------------------------- ### Complete Integration Test Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_api.md An example of a complete integration test that sets up a test context, installs a plugin, and then uses stubs to call methods on application and project-level services within the IDE. It includes assertions to verify the return values. ```kotlin @Test fun testStubs() { Starter.newContext( "testExample", TestCase( IdeProductProvider.IC, GitHubProject.fromGithub( branchName = "master", repoRelativeUrl = "JetBrains/ij-perf-report-aggregator" ) ) .withVersion("2024.3") ) .apply { val pathToPlugin = System.getProperty("path.to.build.plugin") PluginConfigurator(this).installPluginFromFolder(File(pathToPlugin)) }.runIdeWithDriver().useDriverAndCloseIde { val storage = utility().getPluginStorage() val key = storage.getKey() val attributes = storage.getAttributes() Assertions.assertEquals("static method", key) Assertions.assertEquals(listOf("static1", "static2"), attributes) val answer = service().getAnswer() Assertions.assertEquals(42, answer) waitForProjectOpen() val project = singleProject() val strings = service(project).getStrings() Assertions.assertArrayEquals(arrayOf("foo", "bar"), strings) } } ``` -------------------------------- ### Create a Basic Integration Test Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_intro.md Write a simple integration test in Kotlin to start an IDE with a plugin installed, wait for processes, and then shut down. This test requires the 'path.to.build.plugin' system property to be set. ```kotlin import com.intellij.ide.starter.ide.IdeProductProvider import com.intellij.ide.starter.models.TestCase import com.intellij.ide.starter.plugins.PluginConfigurator import com.intellij.ide.starter.project.NoProject import com.intellij.ide.starter.runner.Starter class PluginTest { @Test fun simpleTestWithoutProject() { Starter.newContext( testName = "testExample", TestCase(IdeProductProvider.IC, projectInfo = NoProject) .withVersion("2024.3"), ).apply { val pathToPlugin = System.getProperty("path.to.build.plugin") PluginConfigurator(this).installPluginFromDir(Path.of(pathToPlugin)) }.runIdeWithDriver().useDriverAndCloseIde { } } } ``` -------------------------------- ### Install Plugin from Folder Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_intro.md Installs a plugin into the IDE context using a path specified by the `path.to.build.plugin` system property. This requires a `PluginConfigurator` instance. ```kotlin .apply { val pathToPlugin = System.getProperty("path.to.build.plugin") PluginConfigurator(this).installPluginFromFolder(File(pathToPlugin)) } ``` -------------------------------- ### TemplatePackagePropertyProvider Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/file_and_code_templates/providing_file_templates.md An example provider for the PACKAGE_NAME property, determining it from the file's directory. ```java public class TemplatePackagePropertyProvider implements DefaultTemplatePropertiesProvider { @Override public void fillProperties(@NotNull Properties properties, @NotNull PsiDirectory directory) { String packageName = JavaDirectoryService.getInstance().getPackage(directory); if (packageName != null) { properties.setProperty("PACKAGE_NAME", packageName); } } } ``` -------------------------------- ### Example PhpTypeProvider4 Implementation Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/products/phpstorm/php_open_api_php_type_providers.md An example illustrating how to implement PhpTypeProvider4 to provide types for specific scenarios. ```APIDOC ## Example Implementation The goal of this example is to provide types for field references assigned in `setUp` method if containing class is PHPUnit one. ``` -------------------------------- ### Java Example: IntroduceFieldPostfixTemplate Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/postfix_completion/advanced_postfix_templates.md This Java example demonstrates a postfix template that introduces a class field. It allows selection of non-void expressions at the current cursor position. ```java IntroduceFieldPostfixTemplate ``` -------------------------------- ### Example properties file comment Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/custom_language_support/documentation_provider.md Sample properties file content showing a comment preceding a key/value definition. ```properties # An application programming interface key (API key) is a unique # identifier used to authenticate a user, developer, or calling ``` -------------------------------- ### Setup Dependencies Task Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/gradle_intellij_plugin/tools_gradle_intellij_plugin.md Details about the `setupDependencies` task, which sets up required dependencies for building and running the project. ```APIDOC ## `setupDependencies` ### Description Setup required dependencies for building and running the project. This task is automatically added to the ["After Sync" Gradle trigger](https://www.jetbrains.com/help/idea/work-with-gradle-tasks.html#config_triggers_gradle) to make the IntelliJ SDK dependency available for IntelliJ IDEA right after the Gradle synchronization. ### `idea` #### Description This task exposes the `setupDependencies.idea` property which contains a reference to the resolved IDE dependency used for building the plugin. This property can be referred in Gradle configuration to access IDE dependency classpath. ``` -------------------------------- ### PHP File Path Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/products/phpstorm/php_open_api.md Example of a PHP expression that can be evaluated by PhpFilePathUtils. ```php // in file: /bin/folder/file.php __DIR__ . "/file2.php"; ``` -------------------------------- ### Example: BackendRecentFileEventsModel for Large State Loading Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/remote_development/split_mode_feature_development.md This example demonstrates an approach to avoid loading large states at once by using paging or lazy loading, requesting only necessary UI data. ```kotlin BackendRecentFileEventsModel.kt ``` -------------------------------- ### Setup CI Provider Factory Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/resources/ep_lists/_generated/generated_oss_plugins_extension_point_list.md Factory for providing setup CI providers for Qodana. ```APIDOC ## org.intellij.qodana.setupCIProviderFactory ### Description Factory for providing setup CI providers for Qodana. ### Method N/A (Extension Point) ### Endpoint N/A (Extension Point) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Alignment Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/code_formatting.md Demonstrates how backward shift alignment works for code blocks. ```text int start = 1; int finish = 2; ``` -------------------------------- ### Java Method Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/architectural_overview/psi_references.md A simple Java method demonstrating multiple references to JDK classes and parameters. ```java public void hello(String message) { System.out.println(message); } ``` -------------------------------- ### Standard Plugin Directory Structure Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/intro/sdk_code_guidelines.md Example of a standardized directory layout for an IntelliJ Platform plugin project. ```text code_samples/ foo_basics/ gradle/ src/ main/ java/ org.intellij.sdk.foo/ icons/ SdkIcons.java # The standard SDK icon class resources/ icons/ sdk_16.svg # The standard SDK icon for menus, etc. META-INF/ plugin.xml # The plugin configuration file pluginIcon.svg # The standard SDK plugin icon test/ # Omit if there are no tests java/ org.intellij.sdk.foo/ resources/ build.gradle.kts gradlew gradle.bat settings.gradle.kts README.md ``` -------------------------------- ### Define a basic Web Types file Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/polysymbols_web_types.md A minimal example defining an HTML element with a custom attribute. ```JSON { "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json", "name": "example", "version": "0.0.1", "description-markup": "markdown", "contributions": { "html": { "elements": [ { "name": "my-element", "description": "A custom HTML element", "doc-url": "https://example.com/docs/my-element", "attributes": [ { "name": "foo", "description": "A custom attribute of `my-element`" } ] } ] } } } ``` -------------------------------- ### Sample XML Structure Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/frameworks_and_external_apis/xml_dom_api.md The example XML structure used for demonstrating PSI and DOM access patterns. ```xml 42 239 ``` -------------------------------- ### Setup Project Structure with Module Creation Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/legacy_project_wizard.md Implement this method to create a module for the project if no other modules exist. It iterates through detected project roots and creates new module descriptors. ```java @Override public void setupProjectStructure( @NotNull Collection roots, @NotNull ProjectDescriptor projectDescriptor, @NotNull ProjectFromSourcesBuilder builder) { List modules = projectDescriptor.getModules(); if (modules.isEmpty()) { modules = new ArrayList<>(); for (DetectedProjectRoot root : roots) { modules.add(new ModuleDescriptor(root.getDirectory(), MyModuleType.getInstance(), ContainerUtil.emptyList())); } projectDescriptor.setModules(modules); } } ``` -------------------------------- ### Load and Use Plugins Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/tools_kotlin_notebook.md Demonstrates loading a plugin and checking the current Gradle version. ```kotlin loadPlugins("com.intellij.gradle") ``` ```kotlin import com.intellij.gradle.toolingExtension.util.GradleVersionUtil GradleVersionUtil.isCurrentGradleAtLeast("8.13.0") ``` -------------------------------- ### Example Log Output for Memory Leak Analysis Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/plugin_structure/dynamic_plugins.md This log snippet illustrates a potential memory leak by showing a chain of references starting from a global JNI root to a PluginClassLoader. Analyzing these references helps identify the cause of leaks preventing plugin unloading. ```log 2020-12-26 14:43:24,563 [ 251086] INFO - lij.ide.plugins.DynamicPlugins - Snapshot analysis result: Root 1: ROOT: Global JNI sun.awt.X11.XInputMethod.clientComponentWindow com.intellij.openapi.wm.impl.IdeFrameImpl.rootPane com.intellij.openapi.wm.impl.IdeRootPane.myToolbar com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.myVisibleActions java.util.ArrayList.elementData java.lang.Object[] com.example.ActionExample. com.example.ActionExample. * com.intellij.ide.plugins.cl.PluginClassLoader ``` -------------------------------- ### Access IDE Information Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/tools_kotlin_notebook.md Prints the product name, version, and build number of the current IDE instance. ```kotlin println("IDE: ${productInfo.name}") println("Version: ${productInfo.version}") println("Build: ${productInfo.buildNumber}") ``` -------------------------------- ### Define Plugin Dependencies and Extensions Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/plugin_structure/plugin_dependencies.md Example showing a main plugin descriptor with both required and optional dependencies, alongside extension registrations. ```xml ... com.intellij.java org.jetbrains.kotlin ``` -------------------------------- ### IntelliJ Platform Installers Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/intellij_platform_gradle_plugin/tools_intellij_platform_gradle_plugin_repositories_extension.md Functions for adding repositories to access JetBrains IDEs installers and Android Studio installers. ```APIDOC ## IntelliJ Platform Installers IntelliJ Platform installers are the final IDE distributions delivered to end-users for installing and running products on their machines. Those installers can also be used for development and running the IntelliJ Plugin Verifier tool integrated with the [`verifyPlugin`](tools_intellij_platform_gradle_plugin_tasks.md#verifyPlugin) task. ### `jetbrainsIdeInstallers()` Adds a repository for accessing JetBrains IDEs installers. ### `androidStudioInstallers()` Adds a repository for accessing Android Studio installers. ``` -------------------------------- ### MavenFileTemplateGroupFactory Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/file_and_code_templates/providing_file_templates.md An example implementation of a FileTemplateGroupDescriptorFactory for Maven. ```java public class MavenFileTemplateGroupFactory implements FileTemplateGroupDescriptorFactory { @Override public @NotNull FileTemplateGroupDescriptor getFileTemplateGroupDescriptor(@NotNull Context context) { return new FileTemplateGroupDescriptor("Maven", "", "/resources/fileTemplates/Maven.png"); } } ``` -------------------------------- ### Getting Project-Level Services Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_api.md Demonstrates how to obtain a project instance using `singleProject()` and then use it to acquire a project-level service via the `service()` extension method. ```kotlin service().getOpenProjects().singleOrNull() ``` -------------------------------- ### Example: Java Annotation Index Implementation Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/indexing_and_psi_stubs/stub_indexes.md This snippet shows the implementation of `JavaAnnotationIndex`, which is a concrete example of a stub index. ```java JavaAnnotationIndex.java ``` -------------------------------- ### Navigate IDE UI Hierarchy Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_ui.md Use the Driver framework's Kotlin DSL to navigate the IDE's UI hierarchy. This example demonstrates finding the main IDE frame, triggering an action, and then interacting with a specific element within a popup. ```kotlin ideFrame { invokeAction("SearchEverywhere") searchEverywherePopup { actionButtonByXpath(xQuery { byAccessibleName("Preview") }).click() } } ``` -------------------------------- ### Example: Java Class Element Stub Indexing Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/indexing_and_psi_stubs/stub_indexes.md This example demonstrates how `JavaClassElementType.indexStub()` is implemented to index Java class elements. ```java JavaClassElementType.indexStub() ``` -------------------------------- ### Coroutine Header Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/architectural_overview/threading/coroutines/coroutine_dumps.md Provides an example of a coroutine header, including its name, class, job state, and execution context. ```plaintext -[x5 of] "my task":StandaloneCoroutine{Active}, state: SUSPENDED [ComponentManager(ApplicationImpl@xxxxxxxx), Dispatchers.EDT] ``` -------------------------------- ### ProjectActivity Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/resources/ep_lists/_generated/generated_intellij_platform_extension_point_list.md Extension point for activities to be executed after project startup. ```APIDOC ## com.intellij.postStartupActivity ### Description Defines activities that are executed after the initial project startup sequence. ### Class [`ProjectActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) ``` -------------------------------- ### VcsMappingListener Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/resources/ep_lists/_generated/generated_intellij_platform_extension_point_list.md Listens for general VCS configuration changes. ```APIDOC ## VcsMappingListener ### Description Listens for general VCS configuration changes. ### Topic `ProjectLevelVcsManager#VCS_CONFIGURATION_CHANGED` ``` -------------------------------- ### ProductMode Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/intellij_platform_gradle_plugin/tools_intellij_platform_gradle_plugin_types.md Describes a mode in which a product may be started. This can be configured on the target platform dependency to influence how the IDE is started for development and testing. ```APIDOC ## `ProductMode` Describes a mode in which a product may be started. This can be configured on the target platform dependency to influence how the IDE is started for development and testing. ### Enum Values * `MONOLITH`: Indicates that this process performs all necessary tasks to provide smart features itself. This is the default mode for all IDEs. * `FRONTEND`: Indicates that this process doesn't perform heavy tasks like code analysis, and takes necessary information from another process. Currently used by JetBrains Client connected to a remote development host or Code With Me session. * `BACKEND`: Indicates that this process doesn't perform heavy tasks like code analysis and takes necessary information from another process. Currently used by an IDE running as a remote development host. ``` -------------------------------- ### Run IDE with Plugin Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/code_samples/oauth2/README.md Execute this command to build and run the IDE with the integrated plugin. ```bash ./gradlew runIde ``` -------------------------------- ### Java Example: StreamPostfixTemplate Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/postfix_completion/advanced_postfix_templates.md This Java example shows a postfix template that wraps an array expression within the `Arrays.stream()` method. It utilizes live template syntax for expansion. ```java StreamPostfixTemplate ``` -------------------------------- ### Example: RecentFilesEditorTypingListener for Debouncing UI Events Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/remote_development/split_mode_feature_development.md This example illustrates how to avoid chatty RPC calls by batching requests, caching results, and debouncing UI events, such as typing. ```kotlin RecentFilesEditorTypingListener.kt ``` -------------------------------- ### Create Test Context Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_intro.md Initializes the test context with a specific test name, IDE product, and version. Use `NoProject` to start the IDE with the welcome screen. ```kotlin Starter.newContext( testName = "testExample", TestCase(IdeProductProvider.IC, projectInfo = NoProject ).withVersion("2024.3")) ``` -------------------------------- ### Preview Markup for Inlay Hints (Pre-2023.2) Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/inlay_hints.md Use this markup for previewing inlay hints in versions prior to 2023.2. The preview file should be named 'preview.' within the 'inlayProviders/$provider_id$' directory. ```xml <# Displayed Hint #> ``` -------------------------------- ### Web Component Definition Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/polysymbols_web_types.md A comprehensive example of a Web Component definition using Web Types, including elements, attributes, slots, events, JS properties, and CSS properties. ```JSON { "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json", "name": "Cool library", "version": "1.0.0", "js-types-syntax": "typescript", "description-markup": "markdown", "contributions": { "html": { "elements": [ { "name": "cool-component", "description": "Use the cool component to make your website more attractive.", "doc-url": "https://example.com/docs/cool-component", "attributes": [ { "name": "color", "description": "Choose color for coolness", "default": "blue", "required": false, "doc-url": "https://example.com/docs/cool-component#attrs", "value": { "type": "string" } } ], "slots": [ { "name": "container" } ], "events": [ { "name": "color:changed", "description": "Emitted when color changes" } ], "js": { "properties": [ { "name": "color", "type": "string", "default": "blue" } ] }, "css": { "properties": [ { "name": "--cool-degree" } ] } } ] } } } ``` -------------------------------- ### Declare IntelliJ Platform Installer Dependency (Groovy) Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/intellij_platform_gradle_plugin/tools_intellij_platform_gradle_plugin_dependencies_extension.md Use this configuration to declare a dependency on the IntelliJ Platform installer, which is the IDE's final distribution. This artifact is resolved from JetBrains Download CDN. ```groovy repositories { intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { intellijIdea '%ijPlatform%' } } ``` -------------------------------- ### Declare IntelliJ Platform Installer Dependency (Kotlin) Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/intellij_platform_gradle_plugin/tools_intellij_platform_gradle_plugin_dependencies_extension.md Use this configuration to declare a dependency on the IntelliJ Platform installer, which is the IDE's final distribution. This artifact is resolved from JetBrains Download CDN. ```kotlin repositories { intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { intellijIdea("%ijPlatform%") } } ``` -------------------------------- ### Complete Type Example: Type Hint Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/products/phpstorm/php_open_api_php_type_providers.md Demonstrates a complete type inference using a function parameter type hint. ```php of class com.example.ClassType See the cause for the corresponding Disposer.register() stacktrace: at ObjectTree.assertIsEmpty(ObjectTree.java:209) at Disposer.assertIsEmpty(Disposer.java:125) at Disposer.assertIsEmpty(Disposer.java:121) at ApplicationImpl.disposeSelf(ApplicationImpl.java:323) at ApplicationImpl.doExit(ApplicationImpl.java:780) … Caused by: java.lang.Throwable at ObjectTree.getOrCreateNodeFor(ObjectTree.java:101) at ObjectTree.register(ObjectTree.java:62) at Disposer.register(Disposer.java:81) at Disposer.register(Disposer.java:75) … at ProjectManagerEx.createProject(ProjectManagerEx.java:69) at NewProjectWizardDynamic.doFinish(NewProjectWizardDynamic.java:235) at DynamicWizard$1.run(DynamicWizard.java:433) at CoreProgressManager$5.run(CoreProgressManager.java:237) at CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563) … ``` -------------------------------- ### Create UI Layout with panel Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/user_interface_components/kotlin_ui_dsl.md Use the panel function to initialize the UI layout structure. ```kotlin panel { row { // child components } } ``` -------------------------------- ### Get Project SDK Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/project_model/sdk.md Retrieves the current project-level SDK instance. ```java Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk(); ``` -------------------------------- ### Implement DemoSettingsEditor Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/run_configurations_tutorial.md Implement the SettingsEditor class to provide a UI for configuring your run configuration. This allows users to input parameters like the script path. ```java package org.jetbrains.sdk.runConfiguration; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.SettingsEditor; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.ui.components.fields.ExpandableSupport; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; public class DemoSettingsEditor extends SettingsEditor { private JPanel mainPanel; private TextFieldWithBrowseButton scriptPathField; public DemoSettingsEditor() { $$$setupUI$$$(); // This method is generated by JFormDesigner } @Override protected void resetEditor(@NotNull DemoRunConfiguration configuration) { scriptPathField.setText(configuration.getOptions().getScriptPath()); } @Override protected void applyEditorTo(@NotNull DemoRunConfiguration configuration) throws ConfigurationException { configuration.getOptions().setScriptPath(scriptPathField.getText()); } @NotNull @Override protected JComponent createEditor(@NotNull JComponent parent) { return mainPanel; } @Override protected void disposeEditor(@NotNull JComponent component) { } private void $$$setupUI$$$() { mainPanel = new JPanel(); mainPanel.setLayout(new GridBagLayout()); scriptPathField = new TextFieldWithBrowseButton(); mainPanel.add(scriptPathField, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ExpandableSupport.register(scriptPathField, null, null); } } ``` -------------------------------- ### Define Polish NLS Translations Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/localization/internationalization.md Example of property keys for Polish translations. ```properties dialog.title.add.0=Dodaj {0} dialog.title.add.0=Edytuj {0} concept.library=Bibilioteka concept.dependency=Zależność ``` -------------------------------- ### Define XML-based DSL structure Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/language_injection.md Example XML structure for a custom DSL. ```xml foo System.out.println(42); ``` -------------------------------- ### Concise UI Navigation (Less Precise) Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/testing_plugins/integration_tests/integration_tests_ui.md A more concise way to navigate the UI, but it can lead to reduced precision and readability. This example directly searches for a button within the entire IDE frame without specifying a particular popup or container. ```kotlin ideFrame { actionButtonByXpath(xQuery { byAccessibleName("Preview") }).click() } ``` -------------------------------- ### Creating highlighted code sample Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md Use HtmlSyntaxInfoUtil to generate Lexer-based highlighted code samples for documentation. ```text {title="Creating highlighted code sample"} ``` -------------------------------- ### Load Additional Plugins Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/tools_kotlin_notebook.md Explicitly load bundled or installed plugins into the notebook classpath. ```kotlin loadPlugins("Git4Idea", "com.intellij.java") ``` -------------------------------- ### Module Descriptor Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/basics/remote_development/split_mode_feature_development.md Each module (Shared, Backend, Frontend) requires its own XML descriptor file in the resources directory. ```xml .Shared Shared module for MyPlugin com.intellij.modules.platform ``` ```xml .Backend Backend module for MyPlugin com.intellij.modules.platform.backend ``` ```xml .Frontend Frontend module for MyPlugin com.intellij.modules.platform.frontend ``` -------------------------------- ### Run IDE Task Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/gradle_intellij_plugin/tools_gradle_intellij_plugin.md Task for running the IDE instance with the developed plugin installed. ```APIDOC ## `runIde` Task ### Description Run the IDE instance with the developed plugin installed. `runIde` task extends the [`JavaExec`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html) Gradle task – all properties available in the `JavaExec` as well as the following ones can be used to configure the `runIde` task. ### Parameters #### Path Parameters - **ideDir** (File) - Optional - The IDE dependency sources path. Default value: [`setupDependencies.idea`](#tasks-setupdependencies-idea) ``` -------------------------------- ### Configure Root Project for Multi-Module Setup (Groovy) Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/appendix/tools/intellij_platform_gradle_plugin/tools_intellij_platform_gradle_plugin_plugins.md Configure the root project's name and include submodules in a multi-module Gradle build using Groovy. ```groovy rootProject.name = '...' include ':submodule' ``` -------------------------------- ### FileTemplateGroupDescriptor Subclass Example Source: https://github.com/jetbrains/intellij-sdk-docs/blob/main/topics/tutorials/file_and_code_templates/providing_file_templates.md Demonstrates FileTemplateGroupDescriptor as a subclass of FileTemplateDescriptor, enabling nested groups. ```java public abstract class FileTemplateGroupDescriptor extends FileTemplateDescriptor { public FileTemplateGroupDescriptor(@NotNull String name) { super(name); } public FileTemplateGroupDescriptor(@NotNull String name, @Nullable String iconPath) { super(name, iconPath); } public FileTemplateGroupDescriptor(@NotNull String name, @Nullable String iconPath, @Nullable String helpId) { super(name, iconPath, helpId); } @NotNull public abstract FileTemplate[] getTemplates(); @NotNull public abstract FileTemplateGroupDescriptor[] getSubGroups(); } ```