[Java] Create module intellij.java.terminal.tests

[Java] Refactor code in java-terminal module

IDEA-359113

[Java] Create custom terminal bundle

IDEA-359113

[Java] Add intellij.java.terminal to ultimate-distribution

IDEA-359113

[Java] Create module intellij.java.terminal.tests

IDEA-359113

[Java] Create module intellij.java.terminal

IDEA-359113


Merge-request: IJ-MR-144763
Merged-by: Georgii Ustinov <georgii.ustinov@jetbrains.com>

GitOrigin-RevId: b0baf6bc03a3757ffd79d2cc45ecc7799dca06bf
This commit is contained in:
Georgii Ustinov
2024-09-17 11:16:37 +00:00
committed by intellij-monorepo-bot
parent a395f48809
commit 21cb37ca2a
12 changed files with 112 additions and 0 deletions

2
.idea/modules.xml generated
View File

@@ -466,6 +466,8 @@
<module fileurl="file://$PROJECT_DIR$/java/java-runtime/intellij.java.rt.iml" filepath="$PROJECT_DIR$/java/java-runtime/intellij.java.rt.iml" />
<module fileurl="file://$PROJECT_DIR$/java/structuralsearch-java/intellij.java.structuralSearch.iml" filepath="$PROJECT_DIR$/java/structuralsearch-java/intellij.java.structuralSearch.iml" />
<module fileurl="file://$PROJECT_DIR$/java/java-structure-view/intellij.java.structureView.iml" filepath="$PROJECT_DIR$/java/java-structure-view/intellij.java.structureView.iml" />
<module fileurl="file://$PROJECT_DIR$/java/java-terminal/intellij.java.terminal.iml" filepath="$PROJECT_DIR$/java/java-terminal/intellij.java.terminal.iml" />
<module fileurl="file://$PROJECT_DIR$/java/java-terminal/intellij.java.terminal.tests.iml" filepath="$PROJECT_DIR$/java/java-terminal/intellij.java.terminal.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/java/testFramework/intellij.java.testFramework.iml" filepath="$PROJECT_DIR$/java/testFramework/intellij.java.testFramework.iml" />
<module fileurl="file://$PROJECT_DIR$/java/java-tests/intellij.java.tests.iml" filepath="$PROJECT_DIR$/java/java-tests/intellij.java.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/java/typeMigration/intellij.java.typeMigration.iml" filepath="$PROJECT_DIR$/java/typeMigration/intellij.java.typeMigration.iml" />

View File

@@ -224,5 +224,7 @@
<orderEntry type="module" module-name="intellij.java.compiler.charts" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.platform.compose" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.json.split" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.java.terminal.tests" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.java.terminal" scope="RUNTIME" />
</component>
</module>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.terminal" exported="" />
<orderEntry type="module" module-name="intellij.platform.core" />
</component>
</module>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/test">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.java.testFramework" scope="TEST" />
<orderEntry type="module" module-name="intellij.java.terminal" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.tests" scope="TEST" />
</component>
</module>

View File

@@ -0,0 +1,9 @@
<idea-plugin package="com.intellij.java.terminal">
<module value="intellij.java.terminal" />
<dependencies>
<plugin id="org.jetbrains.plugins.terminal"/>
</dependencies>
<extensions defaultExtensionNs="org.jetbrains.plugins.terminal">
<commandSpecsProvider implementation="com.intellij.java.terminal.JavaShellCommandSpecsProvider"/>
</extensions>
</idea-plugin>

View File

@@ -0,0 +1,2 @@
java.command.terminal.description=Runs java
java.command.terminal.help.option.description=Prints help message

View File

@@ -0,0 +1,21 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.terminal
import com.intellij.terminal.completion.spec.ShellCommandSpec
import org.jetbrains.plugins.terminal.block.completion.spec.ShellCommandSpec
import org.jetbrains.plugins.terminal.block.completion.spec.ShellCommandSpecConflictStrategy
import org.jetbrains.plugins.terminal.block.completion.spec.ShellCommandSpecInfo
import org.jetbrains.plugins.terminal.block.completion.spec.ShellCommandSpecsProvider
class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
override fun getCommandSpecs(): List<ShellCommandSpecInfo> {
return listOf(ShellCommandSpecInfo.create(getSpecs(), ShellCommandSpecConflictStrategy.REPLACE))
}
}
private fun getSpecs() : ShellCommandSpec = ShellCommandSpec("java") {
description(JavaTerminalBundle.message("java.command.terminal.description"))
option("--help", "-help", "-h") {
description(JavaTerminalBundle.message("java.command.terminal.help.option.description"))
}
}

View File

@@ -0,0 +1,23 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.terminal
import com.intellij.DynamicBundle
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.PropertyKey
import java.util.function.Supplier
private const val BUNDLE: String = "messages.JavaTerminalBundle"
object JavaTerminalBundle {
private val INSTANCE = DynamicBundle(JavaTerminalBundle::class.java, BUNDLE)
@JvmStatic
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): @Nls String {
return INSTANCE.getMessage(key = key, params = params)
}
@JvmStatic
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): Supplier<@Nls String> {
return INSTANCE.getLazyMessage(key = key, params = params)
}
}

View File

@@ -0,0 +1,20 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.terminal.completion
import com.intellij.terminal.completion.spec.ShellCompletionSuggestion
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import kotlinx.coroutines.runBlocking
import org.jetbrains.plugins.terminal.block.util.ShellCompletionTestFixture
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
class JavaCommandCompletionTest : BasePlatformTestCase() {
@Test
fun runCustomTest() = runBlocking {
val fixture = ShellCompletionTestFixture.builder(project).build()
val actual: List<ShellCompletionSuggestion> = fixture.getCompletions("java ")
assertSameElements(actual.map { it.name }, listOf("--help", "-help", "-h"))
}
}

View File

@@ -68,6 +68,7 @@
contentModules:
- name: intellij.java.performancePlugin
- name: intellij.java.compiler.charts
- name: intellij.java.terminal
- name: lib/javac2.jar
modules:
- name: intellij.java.compiler.antTasks

View File

@@ -38,6 +38,7 @@
<module name="intellij.java.unscramble"/>
<module name="intellij.java.vcs"/>
<module name="intellij.java.compiler.charts"/>
<module name="intellij.java.terminal"/>
</content>
<depends optional="true" config-file="intellij.java.remoteServers.impl.xml">com.intellij.modules.remoteServers</depends>

View File

@@ -60,6 +60,7 @@ object JavaPluginLayout {
spec.withModules(listOf(
"intellij.java.compiler.impl",
"intellij.java.debugger.impl",
"intellij.java.terminal",
"intellij.java.debugger.memory.agent",
"intellij.java.execution.impl",
"intellij.java.ui",