i18n: add bundle for idea/refactoring/pullUp
- Add @NonNls to used methods from `KtPsiFactory`
This commit is contained in:
committed by
Dmitry Gridin
parent
73de63cefc
commit
37e1333fe1
@@ -13,6 +13,7 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiFileFactory
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.util.LocalTimeCounter
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
@@ -58,7 +59,7 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return createProperty("val x =\n$text").initializer
|
||||
}
|
||||
|
||||
fun createExpression(text: String): KtExpression {
|
||||
fun createExpression(@NonNls text: String): KtExpression {
|
||||
val expression = doCreateExpression(text) ?: error("Failed to create expression from text: '$text'")
|
||||
assert(expression.text == text) {
|
||||
"Failed to create expression from text: '$text', resulting expression's text was: '${expression.text}'"
|
||||
@@ -169,7 +170,7 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return createWhiteSpace("\n".repeat(lineBreaks))
|
||||
}
|
||||
|
||||
fun createClass(text: String): KtClass {
|
||||
fun createClass(@NonNls text: String): KtClass {
|
||||
return createDeclaration(text)
|
||||
}
|
||||
|
||||
@@ -253,7 +254,7 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return createProperty(name, type, isVar, null)
|
||||
}
|
||||
|
||||
fun createProperty(text: String): KtProperty {
|
||||
fun createProperty(@NonNls text: String): KtProperty {
|
||||
return createDeclaration(text)
|
||||
}
|
||||
|
||||
@@ -327,7 +328,7 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return createSimpleName(name).getIdentifier()!!
|
||||
}
|
||||
|
||||
fun createFunction(funDecl: String): KtNamedFunction {
|
||||
fun createFunction(@NonNls funDecl: String): KtNamedFunction {
|
||||
return createDeclaration(funDecl)
|
||||
}
|
||||
|
||||
|
||||
@@ -859,6 +859,7 @@ text.0.is.not.allowed.in.the.target.context=''{0}'' is not allowed in the target
|
||||
text.0.is.not.valid.package.name={0} is not a valid package name
|
||||
text.0.to.inline={0} to inline
|
||||
text.0.uses.1.which.will.be.inaccessible.after.move={0} uses {1} which will be inaccessible after move
|
||||
text.0.uses.1.which.will.not.be.accessible.from.subclass={0} uses {1} which won''t be accessible from the subclass.
|
||||
text.0.uses.internal.1.which.will.be.inaccessible.after.move={0} uses internal {1} which will be inaccessible after move
|
||||
text.0.will.no.longer.be.accessible.after.signature.change={0} will no longer be accessible after signature change
|
||||
text.all.declarations.must.belong.to.the.same.directory.or.class=All declarations must belong to the same directory or class
|
||||
@@ -877,6 +878,7 @@ text.cannot.move.inner.class.0.into.itself=Cannot move nested class {0} to itsel
|
||||
text.cannot.move.to.original.file=Can't move to the original file
|
||||
text.change.file.package.to.0=Change file''s package to ''{0}''
|
||||
text.choose.containing.file=Choose Containing File
|
||||
text.class.0.already.contains.member.1={0} already contains {1}
|
||||
text.class.0.already.exists.in.package.1=Class {0} already exists in package {1}
|
||||
text.class.0.already.exists.in.the.target.scope=Class {0} already exists in the target scope
|
||||
text.constructor=constructor
|
||||
@@ -894,6 +896,7 @@ text.extract.superclass=Extract Superclass
|
||||
text.file.0.already.exists.in.1=File {0} already exists in {1}
|
||||
text.file.name.cannot.be.empty=File name may not be empty
|
||||
text.function.already.exists=Function already exists: ''{0}''
|
||||
text.function.in.ticks.0=function ''{0}''
|
||||
text.function=function
|
||||
text.implicit.companion.object.will.be.inaccessible.0=Implicit companion object will be inaccessible: {0}
|
||||
text.incorrect.target.path.directory.0.does.not.belong.to.current.project=Incorrect target path. Directory {0} does not belong to current project.
|
||||
@@ -904,6 +907,7 @@ text.inline.all.references.and.0.the.1=Inline all references and {0} the kind {1
|
||||
text.inline.recursive.function.is.supported.only.on.references=Inline recursive function is supported only on references
|
||||
text.inline.this.reference.and.keep.the.0=Inline this reference and keep the {0}
|
||||
text.inlining.0.1=Inlining {0} {1}
|
||||
text.inner.class.0.cannot.be.moved.to.intefrace={0} is an inner class. It can not be moved to the interface
|
||||
text.introduce.default.value=Intro&duce default value
|
||||
text.invalid.target.path.0=Invalid target path {0}
|
||||
text.invalid.target.specified=Invalid target specified
|
||||
@@ -915,6 +919,7 @@ text.lazy.property=lazy property
|
||||
text.local.property=property
|
||||
text.local.variable=local variable
|
||||
text.looking.for.usages=Looking for Usages
|
||||
text.member.0.in.super.class.will.clash.with.existing.member.of.1={0} in super class would clash with existing member of {1}
|
||||
text.member.extension.call.will.not.be.processed.0=Member extension call won''t be processed: {0}
|
||||
text.move.declaration.no.support.for.companion.objects=Move declaration is not supported for companion objects
|
||||
text.move.declaration.no.support.for.enums=Move declaration is not supported for enum entries
|
||||
@@ -940,6 +945,7 @@ text.parameters=&Parameters
|
||||
text.proceed.with.extraction=Proceed with extraction
|
||||
text.process.duplicates=Process Duplicates
|
||||
text.processing.file.0=Processing {0}
|
||||
text.property.in.ticks.0=property ''{0}''
|
||||
text.property.with.getter=property with getter
|
||||
text.property.with.initializer=property with initializer
|
||||
text.property=property
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.ui.DialogWrapper
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiComment
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import com.intellij.refactoring.RefactoringBundle
|
||||
import com.intellij.refactoring.classMembers.MemberInfoChange
|
||||
import com.intellij.refactoring.classMembers.MemberInfoModel
|
||||
import com.intellij.refactoring.memberPullUp.PullUpProcessor
|
||||
@@ -136,7 +137,7 @@ class KotlinPullUpDialog(
|
||||
override fun getPreselection() = mySuperClasses.firstOrNull { !it.isInterfaceClass() } ?: mySuperClasses.firstOrNull()
|
||||
|
||||
override fun createMemberSelectionTable(infos: MutableList<KotlinMemberInfo>) =
|
||||
KotlinMemberSelectionTable(infos, null, "Make abstract")
|
||||
KotlinMemberSelectionTable(infos, null, RefactoringBundle.message("make.abstract"))
|
||||
|
||||
override fun isOKActionEnabled() = selectedMemberInfos.size > 0
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.intellij.psi.PsiNamedElement
|
||||
import com.intellij.refactoring.HelpID
|
||||
import com.intellij.refactoring.RefactoringBundle
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
@@ -37,6 +38,7 @@ class KotlinPullUpHandler : AbstractPullPushMembersHandler(
|
||||
wrongPositionMessage = RefactoringBundle.message("the.caret.should.be.positioned.inside.a.class.to.pull.members.from")
|
||||
) {
|
||||
companion object {
|
||||
@NonNls
|
||||
const val PULL_UP_TEST_HELPER_KEY = "PULL_UP_TEST_HELPER_KEY"
|
||||
}
|
||||
|
||||
@@ -115,4 +117,4 @@ class KotlinPullUpHandler : AbstractPullPushMembersHandler(
|
||||
}
|
||||
}
|
||||
|
||||
const val PULL_MEMBERS_UP = "Pull Members Up"
|
||||
val PULL_MEMBERS_UP: String get() = RefactoringBundle.message("pull.members.up.title")
|
||||
@@ -26,6 +26,7 @@ import com.intellij.refactoring.RefactoringBundle
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.asJava.unwrapped
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.refactoring.checkConflictsInteractively
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KotlinMemberInfo
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.getChildrenToAnalyze
|
||||
@@ -101,7 +102,7 @@ internal fun checkVisibilityInAbstractedMembers(
|
||||
val targetDescriptor = target.resolveToDescriptorWrapperAware(resolutionFacade)
|
||||
val memberText = memberDescriptor.renderForConflicts()
|
||||
val targetText = targetDescriptor.renderForConflicts()
|
||||
val message = "$memberText uses $targetText which won't be accessible from the subclass."
|
||||
val message = KotlinBundle.message("text.0.uses.1.which.will.not.be.accessible.from.subclass", memberText, targetText)
|
||||
conflicts.putValue(target, message.capitalize())
|
||||
}
|
||||
}
|
||||
@@ -131,8 +132,8 @@ fun DeclarationDescriptor.renderForConflicts(): String {
|
||||
return when (this) {
|
||||
is ClassDescriptor -> "${DescriptorRenderer.getClassifierKindPrefix(this)} " +
|
||||
IdeDescriptorRenderers.SOURCE_CODE.renderClassifierName(this)
|
||||
is FunctionDescriptor -> "function '${CALLABLE_RENDERER.render(this)}'"
|
||||
is PropertyDescriptor -> "property '${CALLABLE_RENDERER.render(this)}'"
|
||||
is FunctionDescriptor -> KotlinBundle.message("text.function.in.ticks.0", CALLABLE_RENDERER.render(this))
|
||||
is PropertyDescriptor -> KotlinBundle.message("text.property.in.ticks.0", CALLABLE_RENDERER.render(this))
|
||||
is PackageFragmentDescriptor -> fqName.asString()
|
||||
is PackageViewDescriptor -> fqName.asString()
|
||||
else -> ""
|
||||
@@ -149,7 +150,11 @@ private fun KotlinPullUpData.checkClashWithSuperDeclaration(
|
||||
memberDescriptor: DeclarationDescriptor,
|
||||
conflicts: MultiMap<PsiElement, String>
|
||||
) {
|
||||
val message = "${targetClassDescriptor.renderForConflicts()} already contains ${memberDescriptor.renderForConflicts()}"
|
||||
val message = KotlinBundle.message(
|
||||
"text.class.0.already.contains.member.1",
|
||||
targetClassDescriptor.renderForConflicts(),
|
||||
memberDescriptor.renderForConflicts()
|
||||
)
|
||||
|
||||
if (member is KtParameter) {
|
||||
if (((targetClass as? KtClass)?.primaryConstructorParameters ?: emptyList()).any { it.name == member.name }) {
|
||||
@@ -198,9 +203,11 @@ private fun KotlinPullUpData.checkAccidentalOverrides(
|
||||
memberDescriptorInSubClass?.let { subClassDescriptor.findCallableMemberBySignature(it) } ?: return
|
||||
val clashingMember = clashingMemberDescriptor.source.getPsi() ?: return
|
||||
|
||||
val message = memberDescriptor.renderForConflicts() +
|
||||
" in super class would clash with existing member of " +
|
||||
it.resolveToDescriptorWrapperAware(resolutionFacade).renderForConflicts()
|
||||
val message = KotlinBundle.message(
|
||||
"text.member.0.in.super.class.will.clash.with.existing.member.of.1",
|
||||
memberDescriptor.renderForConflicts(),
|
||||
it.resolveToDescriptorWrapperAware(resolutionFacade).renderForConflicts()
|
||||
)
|
||||
conflicts.putValue(clashingMember, message.capitalize())
|
||||
}
|
||||
}
|
||||
@@ -213,7 +220,7 @@ private fun KotlinPullUpData.checkInnerClassToInterface(
|
||||
conflicts: MultiMap<PsiElement, String>
|
||||
) {
|
||||
if (isInterfaceTarget && memberDescriptor is ClassDescriptor && memberDescriptor.isInner) {
|
||||
val message = "${memberDescriptor.renderForConflicts()} is an inner class. It can not be moved to the interface"
|
||||
val message = KotlinBundle.message("text.inner.class.0.cannot.be.moved.to.intefrace", memberDescriptor.renderForConflicts())
|
||||
conflicts.putValue(member, message.capitalize())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user