Fix source compatibility with 183 platform
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ class ExtensionFunctionTypeValueCompletion(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleInsert(context: InsertionContext?) {
|
override fun handleInsert(context: InsertionContext) {
|
||||||
insertHandler.handleInsert(context, this)
|
insertHandler.handleInsert(context, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -16,7 +16,6 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.intellij.openapi.editor.ScrollType
|
import com.intellij.openapi.editor.ScrollType
|
||||||
import com.intellij.openapi.progress.ProgressIndicator
|
import com.intellij.openapi.progress.ProgressIndicator
|
||||||
import com.intellij.openapi.progress.util.ProgressWindow
|
import com.intellij.openapi.progress.util.ProgressWindow
|
||||||
import com.intellij.openapi.progress.util.ProgressWindowWithNotification
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
|
|||||||
// rearrange
|
// rearrange
|
||||||
val referenceElement = referencePlugin.xmlElement!!
|
val referenceElement = referencePlugin.xmlElement!!
|
||||||
val newElement = referenceElement.parent.addAfter(plugin.xmlElement!!, referenceElement)
|
val newElement = referenceElement.parent.addAfter(plugin.xmlElement!!, referenceElement)
|
||||||
plugin.xmlTag.delete()
|
plugin.xmlTag?.delete()
|
||||||
|
|
||||||
return domModel.build.plugins.plugins.single { it.xmlElement == newElement }
|
return domModel.build.plugins.plugins.single { it.xmlElement == newElement }
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
|
|||||||
val existingGoals = execution.goals.goals.mapNotNull { it.rawText }
|
val existingGoals = execution.goals.goals.mapNotNull { it.rawText }
|
||||||
for (goal in goals.filter { it !in existingGoals }) {
|
for (goal in goals.filter { it !in existingGoals }) {
|
||||||
val goalTag = execution.goals.ensureTagExists().createChildTag("goal", goal)
|
val goalTag = execution.goals.ensureTagExists().createChildTag("goal", goal)
|
||||||
execution.goals.xmlTag.add(goalTag)
|
execution.goals.xmlTag?.add(goalTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
return execution
|
return execution
|
||||||
@@ -301,20 +301,22 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
|
|||||||
execution.configuration.xmlTag?.findSubTags("sourceDirs")?.forEach { it.deleteCascade() }
|
execution.configuration.xmlTag?.findSubTags("sourceDirs")?.forEach { it.deleteCascade() }
|
||||||
} else {
|
} else {
|
||||||
val sourceDirsTag = executionConfiguration(execution, "sourceDirs")
|
val sourceDirsTag = executionConfiguration(execution, "sourceDirs")
|
||||||
val newSourceDirsTag = execution.configuration.createChildTag("sourceDirs")
|
execution.configuration.createChildTag("sourceDirs")?.let { newSourceDirsTag ->
|
||||||
for (dir in sourceDirs) {
|
for (dir in sourceDirs) {
|
||||||
newSourceDirsTag.add(newSourceDirsTag.createChildTag("source", dir))
|
newSourceDirsTag.add(newSourceDirsTag.createChildTag("source", dir))
|
||||||
|
}
|
||||||
|
sourceDirsTag.replace(newSourceDirsTag)
|
||||||
}
|
}
|
||||||
sourceDirsTag.replace(newSourceDirsTag)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun executionSourceDirs(execution: MavenDomPluginExecution): List<String> {
|
fun executionSourceDirs(execution: MavenDomPluginExecution): List<String> {
|
||||||
return execution.configuration.xmlTag
|
return execution.configuration.xmlTag
|
||||||
.getChildrenOfType<XmlTag>().firstOrNull { it.localName == "sourceDirs" }
|
?.getChildrenOfType<XmlTag>()
|
||||||
|
?.firstOrNull { it.localName == "sourceDirs" }
|
||||||
?.getChildrenOfType<XmlTag>()
|
?.getChildrenOfType<XmlTag>()
|
||||||
?.map { it.getChildrenOfType<XmlText>().joinToString("") { it.text } }
|
?.map { it.getChildrenOfType<XmlText>().joinToString("") { it.text } }
|
||||||
?: emptyList()
|
?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun executionConfiguration(execution: MavenDomPluginExecution, name: String): XmlTag {
|
private fun executionConfiguration(execution: MavenDomPluginExecution, name: String): XmlTag {
|
||||||
@@ -439,7 +441,7 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
|
|||||||
null
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun MavenDomElement.createChildTag(name: String, value: String? = null) = xmlTag.createChildTag(name, value)
|
private fun MavenDomElement.createChildTag(name: String, value: String? = null) = xmlTag?.createChildTag(name, value)
|
||||||
private fun XmlTag.createChildTag(name: String, value: String? = null) = createChildTag(name, namespace, value, false)!!
|
private fun XmlTag.createChildTag(name: String, value: String? = null) = createChildTag(name, namespace, value, false)!!
|
||||||
|
|
||||||
private tailrec fun XmlTag.deleteCascade() {
|
private tailrec fun XmlTag.deleteCascade() {
|
||||||
@@ -667,7 +669,7 @@ private fun PomFile.changeConfigurationOrProperty(
|
|||||||
): XmlTag? {
|
): XmlTag? {
|
||||||
val configuration = kotlinPlugin.configuration
|
val configuration = kotlinPlugin.configuration
|
||||||
if (configuration.exists()) {
|
if (configuration.exists()) {
|
||||||
val subTag = configuration.xmlTag.findFirstSubTag(configurationTagName)
|
val subTag = configuration.xmlTag?.findFirstSubTag(configurationTagName)
|
||||||
if (subTag != null) {
|
if (subTag != null) {
|
||||||
subTag.value.text = value
|
subTag.value.text = value
|
||||||
return subTag
|
return subTag
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
|||||||
|
|
||||||
|
|
||||||
class SearchNotPropertyCandidatesAction : AnAction() {
|
class SearchNotPropertyCandidatesAction : AnAction() {
|
||||||
override fun actionPerformed(e: AnActionEvent?) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val project = e?.project!!
|
val project = e?.project!!
|
||||||
val psiFile = e.getData(CommonDataKeys.PSI_FILE) as? KtFile ?: return
|
val psiFile = e.getData(CommonDataKeys.PSI_FILE) as? KtFile ?: return
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -55,8 +55,8 @@ import javax.swing.JFileChooser
|
|||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
|
|
||||||
abstract class AbstractCompletionBenchmarkAction : AnAction() {
|
abstract class AbstractCompletionBenchmarkAction : AnAction() {
|
||||||
override fun actionPerformed(e: AnActionEvent?) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val project = e?.project ?: return
|
val project = e.project ?: return
|
||||||
|
|
||||||
val benchmarkSink = CompletionBenchmarkSink.enableAndGet()
|
val benchmarkSink = CompletionBenchmarkSink.enableAndGet()
|
||||||
val scenario = createBenchmarkScenario(project, benchmarkSink) ?: return
|
val scenario = createBenchmarkScenario(project, benchmarkSink) ?: return
|
||||||
|
|||||||
+2
-2
@@ -46,8 +46,8 @@ import javax.swing.JFileChooser
|
|||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
class HighlightingBenchmarkAction : AnAction() {
|
class HighlightingBenchmarkAction : AnAction() {
|
||||||
override fun actionPerformed(e: AnActionEvent?) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val project = e?.project ?: return
|
val project = e.project ?: return
|
||||||
|
|
||||||
val settings = showSettingsDialog() ?: return
|
val settings = showSettingsDialog() ?: return
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.actions.internal.benchmark
|
package org.jetbrains.kotlin.idea.actions.internal.benchmark
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.ui.DialogBuilder
|
import com.intellij.openapi.ui.DialogBuilder
|
||||||
import com.intellij.psi.PsiWhiteSpace
|
import com.intellij.psi.PsiWhiteSpace
|
||||||
@@ -66,7 +67,6 @@ class TopLevelCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() {
|
|||||||
return TopLevelCompletionBenchmarkScenario(ktFiles, settings, project, benchmarkSink, random)
|
return TopLevelCompletionBenchmarkScenario(ktFiles, settings, project, benchmarkSink, random)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data class Settings(val seed: Long, val lines: Int, val files: Int)
|
data class Settings(val seed: Long, val lines: Int, val files: Int)
|
||||||
|
|
||||||
private fun showSettingsDialog(): Settings? {
|
private fun showSettingsDialog(): Settings? {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.jetbrains.kotlin.idea.migration
|
|||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
|
||||||
class CodeMigrationAction : CodeInspectionAction("Code Migration", "Code migration") {
|
class CodeMigrationAction : CodeInspectionAction("Code Migration", "Code migration") {
|
||||||
override fun update(e: AnActionEvent?) {
|
override fun update(e: AnActionEvent) {
|
||||||
super.update(e)
|
super.update(e)
|
||||||
|
|
||||||
val project = e?.project
|
val project = e.project
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
e.presentation.isEnabledAndVisible = CodeMigrationToggleAction.isEnabled(project)
|
e.presentation.isEnabledAndVisible = CodeMigrationToggleAction.isEnabled(project)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,34 +196,28 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
|
|||||||
assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element)
|
assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element)
|
||||||
|
|
||||||
val project = editor.project!!
|
val project = editor.project!!
|
||||||
val templateManager = TemplateManager.getInstance(project) as TemplateManagerImpl
|
|
||||||
try {
|
|
||||||
templateManager.setTemplateTesting(true)
|
|
||||||
|
|
||||||
object : WriteCommandAction.Simple<Any>(project) {
|
TemplateManagerImpl.setTemplateTesting(project, testRootDisposable)
|
||||||
override fun run() {
|
|
||||||
handler.invoke(project, editor, file, dataContext)
|
|
||||||
}
|
|
||||||
}.execute()
|
|
||||||
|
|
||||||
var state = TemplateManagerImpl.getTemplateState(editor)
|
object : WriteCommandAction.Simple<Any>(project) {
|
||||||
assert(state != null)
|
override fun run() {
|
||||||
val range = state!!.currentVariableRange
|
handler.invoke(project, editor, file, dataContext)
|
||||||
assert(range != null)
|
}
|
||||||
object : WriteCommandAction.Simple<Any>(project) {
|
}.execute()
|
||||||
override fun run() {
|
|
||||||
editor.document.replaceString(range!!.startOffset, range.endOffset, newName)
|
|
||||||
}
|
|
||||||
}.execute().throwException()
|
|
||||||
|
|
||||||
state = TemplateManagerImpl.getTemplateState(editor)
|
var state = TemplateManagerImpl.getTemplateState(editor)
|
||||||
assert(state != null)
|
assert(state != null)
|
||||||
state!!.gotoEnd(false)
|
val range = state!!.currentVariableRange
|
||||||
}
|
assert(range != null)
|
||||||
finally {
|
object : WriteCommandAction.Simple<Any>(project) {
|
||||||
templateManager.setTemplateTesting(false)
|
override fun run() {
|
||||||
}
|
editor.document.replaceString(range!!.startOffset, range.endOffset, newName)
|
||||||
|
}
|
||||||
|
}.execute().throwException()
|
||||||
|
|
||||||
|
state = TemplateManagerImpl.getTemplateState(editor)
|
||||||
|
assert(state != null)
|
||||||
|
state!!.gotoEnd(false)
|
||||||
|
|
||||||
checkResultByFile(getTestName(false) + ".kt.after")
|
checkResultByFile(getTestName(false) + ".kt.after")
|
||||||
}
|
}
|
||||||
@@ -235,8 +229,8 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
|
|||||||
private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) {
|
private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) {
|
||||||
configureByFile(getTestName(false) + ".kt")
|
configureByFile(getTestName(false) + ".kt")
|
||||||
val element = TargetElementUtil.findTargetElement(
|
val element = TargetElementUtil.findTargetElement(
|
||||||
LightPlatformCodeInsightTestCase.myEditor,
|
LightPlatformCodeInsightTestCase.myEditor,
|
||||||
TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
||||||
)
|
)
|
||||||
|
|
||||||
assertNotNull(element)
|
assertNotNull(element)
|
||||||
|
|||||||
+2
-2
@@ -140,7 +140,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
else -> throw e
|
else -> throw e
|
||||||
}
|
}
|
||||||
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
||||||
UsefulTestCase.assertSameLinesWithFile(conflictsFile.absolutePath, message)
|
UsefulTestCase.assertSameLinesWithFile(conflictsFile.absolutePath, message!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
else -> throw e
|
else -> throw e
|
||||||
}
|
}
|
||||||
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
||||||
UsefulTestCase.assertSameLinesWithFile(conflictsFile.absolutePath, message)
|
UsefulTestCase.assertSameLinesWithFile(conflictsFile.absolutePath, message!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ class AndroidGotoDeclarationHandler : GotoDeclarationHandler {
|
|||||||
return ModuleServiceManager.getService(moduleInfo.module, AndroidLayoutXmlFileManager::class.java)
|
return ModuleServiceManager.getService(moduleInfo.module, AndroidLayoutXmlFileManager::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getActionText(context: DataContext?): String? {
|
override fun getActionText(context: DataContext): String? {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user