KotlinChangeSignature refactoring remove deprecated usage + refactoring
This commit is contained in:
+1
-2
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.psi.KtExpression
|
|||||||
import org.jetbrains.kotlin.psi.KtProperty
|
import org.jetbrains.kotlin.psi.KtProperty
|
||||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||||
import javax.swing.JCheckBox
|
import javax.swing.JCheckBox
|
||||||
import javax.swing.JComboBox
|
|
||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
import javax.swing.JLabel
|
import javax.swing.JLabel
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
@@ -31,7 +30,7 @@ class KotlinChangePropertySignatureDialog(
|
|||||||
private val methodDescriptor: KotlinMethodDescriptor,
|
private val methodDescriptor: KotlinMethodDescriptor,
|
||||||
private val commandName: String?
|
private val commandName: String?
|
||||||
) : RefactoringDialog(project, true) {
|
) : RefactoringDialog(project, true) {
|
||||||
private val visibilityCombo = JComboBox(
|
private val visibilityCombo = ComboBox(
|
||||||
arrayOf(Visibilities.INTERNAL, Visibilities.PRIVATE, Visibilities.PROTECTED, Visibilities.PUBLIC)
|
arrayOf(Visibilities.INTERNAL, Visibilities.PRIVATE, Visibilities.PROTECTED, Visibilities.PUBLIC)
|
||||||
)
|
)
|
||||||
private val nameField = EditorTextField(methodDescriptor.name)
|
private val nameField = EditorTextField(methodDescriptor.name)
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui
|
||||||
|
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.openapi.ui.Messages
|
||||||
|
import com.intellij.openapi.ui.Messages.OkCancelResult
|
||||||
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import javax.swing.Icon
|
||||||
|
|
||||||
|
// BUNCH: 193
|
||||||
|
|
||||||
|
@OkCancelResult
|
||||||
|
fun showOkCancelDialog(
|
||||||
|
project: Project?,
|
||||||
|
message: String?,
|
||||||
|
title: String,
|
||||||
|
icon: Icon?
|
||||||
|
): Int {
|
||||||
|
return Messages.showOkCancelDialog(
|
||||||
|
project,
|
||||||
|
message,
|
||||||
|
title,
|
||||||
|
icon
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
typealias ComboBox = javax.swing.JComboBox<Visibility>
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui
|
||||||
|
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.openapi.ui.Messages
|
||||||
|
import com.intellij.openapi.ui.Messages.OkCancelResult
|
||||||
|
import javax.swing.Icon
|
||||||
|
|
||||||
|
// BUNCH: 193
|
||||||
|
|
||||||
|
@OkCancelResult
|
||||||
|
fun showOkCancelDialog(
|
||||||
|
project: Project?,
|
||||||
|
message: String?,
|
||||||
|
title: String,
|
||||||
|
icon: Icon?
|
||||||
|
): Int {
|
||||||
|
return Messages.showOkCancelDialog(
|
||||||
|
project,
|
||||||
|
message,
|
||||||
|
title,
|
||||||
|
Messages.OK_BUTTON,
|
||||||
|
Messages.CANCEL_BUTTON,
|
||||||
|
icon
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
typealias ComboBox = com.intellij.openapi.ui.ComboBox<Visibility>
|
||||||
+2
-2
@@ -332,7 +332,7 @@ class KotlinChangeSignatureDialog(
|
|||||||
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
|
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
|
||||||
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false, reanalyse = true).type == null
|
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false, reanalyse = true).type == null
|
||||||
) {
|
) {
|
||||||
if (Messages.showOkCancelDialog(
|
if (showOkCancelDialog(
|
||||||
myProject,
|
myProject,
|
||||||
KotlinBundle.message("message.text.return.type.cannot.be.resolved",
|
KotlinBundle.message("message.text.return.type.cannot.be.resolved",
|
||||||
myReturnTypeCodeFragment?.text.toString()
|
myReturnTypeCodeFragment?.text.toString()
|
||||||
@@ -351,7 +351,7 @@ class KotlinChangeSignatureDialog(
|
|||||||
KotlinBundle.message("text.parameter.0", item.parameter.name)
|
KotlinBundle.message("text.parameter.0", item.parameter.name)
|
||||||
else
|
else
|
||||||
KotlinBundle.message("text.receiver")
|
KotlinBundle.message("text.receiver")
|
||||||
if (Messages.showOkCancelDialog(
|
if (showOkCancelDialog(
|
||||||
myProject,
|
myProject,
|
||||||
KotlinBundle.message("message.type.for.cannot.be.resolved",
|
KotlinBundle.message("message.type.for.cannot.be.resolved",
|
||||||
item.typeCodeFragment.text,
|
item.typeCodeFragment.text,
|
||||||
|
|||||||
+2
-2
@@ -334,7 +334,7 @@ class KotlinChangeSignatureDialog(
|
|||||||
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
|
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
|
||||||
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false).type == null
|
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false).type == null
|
||||||
) {
|
) {
|
||||||
if (Messages.showOkCancelDialog(
|
if (showOkCancelDialog(
|
||||||
myProject,
|
myProject,
|
||||||
KotlinBundle.message("message.text.return.type.cannot.be.resolved",
|
KotlinBundle.message("message.text.return.type.cannot.be.resolved",
|
||||||
myReturnTypeCodeFragment?.text.toString()
|
myReturnTypeCodeFragment?.text.toString()
|
||||||
@@ -353,7 +353,7 @@ class KotlinChangeSignatureDialog(
|
|||||||
KotlinBundle.message("text.parameter.0", item.parameter.name)
|
KotlinBundle.message("text.parameter.0", item.parameter.name)
|
||||||
else
|
else
|
||||||
KotlinBundle.message("text.receiver")
|
KotlinBundle.message("text.receiver")
|
||||||
if (Messages.showOkCancelDialog(
|
if (showOkCancelDialog(
|
||||||
myProject,
|
myProject,
|
||||||
KotlinBundle.message("message.type.for.cannot.be.resolved",
|
KotlinBundle.message("message.type.for.cannot.be.resolved",
|
||||||
item.typeCodeFragment.text,
|
item.typeCodeFragment.text,
|
||||||
|
|||||||
Reference in New Issue
Block a user