Refactoring
This commit is contained in:
@@ -61,7 +61,7 @@ class ChangeFunctionLiteralSignatureFix(
|
||||
text)
|
||||
}
|
||||
|
||||
companion object : KotlinIntentionActionFactoryWithDelegate<JetFunctionLiteral, Data>() {
|
||||
companion object : KotlinSingleIntentionActionFactoryWithDelegate<JetFunctionLiteral, Data>() {
|
||||
data class Data(val functionLiteral: JetFunctionLiteral, val descriptor: FunctionDescriptor, val parameterTypes: List<JetType>)
|
||||
|
||||
override fun getElementOfInterest(diagnostic: Diagnostic): JetFunctionLiteral? {
|
||||
|
||||
@@ -76,7 +76,7 @@ abstract class ChangeFunctionSignatureFix(
|
||||
}
|
||||
}
|
||||
|
||||
companion object : KotlinIntentionActionFactoryWithDelegate<JetCallElement, Data>() {
|
||||
companion object : KotlinSingleIntentionActionFactoryWithDelegate<JetCallElement, Data>() {
|
||||
data class Data(val callElement: JetCallElement, val descriptor: CallableDescriptor)
|
||||
|
||||
override fun getElementOfInterest(diagnostic: Diagnostic): JetCallElement? {
|
||||
|
||||
+12
-4
@@ -27,16 +27,24 @@ import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
|
||||
public abstract class KotlinIntentionActionFactoryWithDelegate<E : JetElement, D : Any> : JetIntentionActionsFactory() {
|
||||
protected abstract fun getElementOfInterest(diagnostic: Diagnostic): E?
|
||||
|
||||
abstract class KotlinSingleIntentionActionFactoryWithDelegate<E : JetElement, D : Any> : KotlinIntentionActionFactoryWithDelegate<E, D>() {
|
||||
protected open fun createQuickFix(diagnostic: Diagnostic, quickFixDataFactory: () -> D?): QuickFixWithDelegateFactory? = null
|
||||
|
||||
protected open fun createQuickFixes(
|
||||
protected override final fun createQuickFixes(
|
||||
originalElementPointer: SmartPsiElementPointer<E>,
|
||||
diagnostic: Diagnostic,
|
||||
quickFixDataFactory: () -> D?
|
||||
): List<QuickFixWithDelegateFactory> = createQuickFix(diagnostic, quickFixDataFactory).singletonOrEmptyList()
|
||||
}
|
||||
|
||||
abstract class KotlinIntentionActionFactoryWithDelegate<E : JetElement, D : Any> : JetIntentionActionsFactory() {
|
||||
protected abstract fun getElementOfInterest(diagnostic: Diagnostic): E?
|
||||
|
||||
protected abstract fun createQuickFixes(
|
||||
originalElementPointer: SmartPsiElementPointer<E>,
|
||||
diagnostic: Diagnostic,
|
||||
quickFixDataFactory: () -> D?
|
||||
): List<QuickFixWithDelegateFactory>
|
||||
|
||||
protected abstract fun createQuickFixData(element: E, diagnostic: Diagnostic): D?
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.idea.quickfix.createFromUsage.createVariable
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionFactoryWithDelegate
|
||||
import org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactoryWithDelegate
|
||||
import org.jetbrains.kotlin.idea.quickfix.QuickFixWithDelegateFactory
|
||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.JetParameterInfo
|
||||
import org.jetbrains.kotlin.psi.JetElement
|
||||
@@ -30,7 +30,7 @@ data class CreateParameterData<E : JetElement>(
|
||||
val originalExpression: E
|
||||
)
|
||||
|
||||
abstract class CreateParameterFromUsageFactory<E : JetElement>: KotlinIntentionActionFactoryWithDelegate<E, CreateParameterData<E>>() {
|
||||
abstract class CreateParameterFromUsageFactory<E : JetElement>: KotlinSingleIntentionActionFactoryWithDelegate<E, CreateParameterData<E>>() {
|
||||
override fun createQuickFix(
|
||||
diagnostic: Diagnostic,
|
||||
quickFixDataFactory: () -> CreateParameterData<E>?
|
||||
|
||||
Reference in New Issue
Block a user