mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[python][i18n] Move messages in RenamePyElementProcessor.findExistingNameConflicts to a bundle
GitOrigin-RevId: 744c3c814264cc270848debefa1f06c123abaaad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
795017aa44
commit
82604f9dae
@@ -144,6 +144,12 @@ refactoring.rename.inheritor.classes.with.the.following.names.to=Rename inherito
|
||||
refactoring.rename.inheritors.title=Rename Inheritors
|
||||
refactoring.rename.inheritors=Rename inheritors
|
||||
refactoring.rename.inheritor.class.entity.name=Inheritor Class
|
||||
refactoring.rename.class.already.defined=A class named ''{0}'' is already defined in {1}
|
||||
refactoring.rename.function.already.defined=A function named ''{0}'' is already defined in {1}
|
||||
refactoring.rename.variable.already.defined=A variable named ''{0}'' is already defined in {1}
|
||||
refactoring.rename.nested.class.already.defined=A class named ''{0}'' is already defined in class ''{1}''
|
||||
refactoring.rename.method.already.defined=A function named ''{0}'' is already defined in class ''{1}''
|
||||
refactoring.rename.class.attribute.already.defined=An attribute named ''{0}'' is already defined in class ''{1}''
|
||||
|
||||
python.run.select.script=Select Script
|
||||
python.scripts=Python scripts
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.refactoring.rename;
|
||||
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.rename.RenamePsiElementProcessor;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,34 +14,41 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class RenamePyElementProcessor extends RenamePsiElementProcessor {
|
||||
@Override
|
||||
public void findExistingNameConflicts(@NotNull PsiElement element, @NotNull String newName, @NotNull MultiMap<PsiElement, String> conflicts) {
|
||||
public void findExistingNameConflicts(@NotNull PsiElement element,
|
||||
@NotNull String newName,
|
||||
@NotNull MultiMap<PsiElement, @NlsContexts.DialogMessage String> conflicts) {
|
||||
PyElement container = PsiTreeUtil.getParentOfType(element, ScopeOwner.class);
|
||||
if (container instanceof PyFile pyFile) {
|
||||
PyClass conflictingClass = pyFile.findTopLevelClass(newName);
|
||||
if (conflictingClass != null) {
|
||||
conflicts.putValue(conflictingClass, "A class named '" + newName + "' is already defined in " + pyFile.getName());
|
||||
conflicts.putValue(conflictingClass, PyBundle.message("refactoring.rename.class.already.defined", newName, pyFile.getName()));
|
||||
}
|
||||
PyFunction conflictingFunction = pyFile.findTopLevelFunction(newName);
|
||||
if (conflictingFunction != null) {
|
||||
conflicts.putValue(conflictingFunction, "A function named '" + newName + "' is already defined in " + pyFile.getName());
|
||||
conflicts.putValue(conflictingFunction,
|
||||
PyBundle.message("refactoring.rename.function.already.defined", newName, pyFile.getName()));
|
||||
}
|
||||
PyTargetExpression conflictingVariable = pyFile.findTopLevelAttribute(newName);
|
||||
if (conflictingVariable != null) {
|
||||
conflicts.putValue(conflictingVariable, "A variable named '" + newName + "' is already defined in " + pyFile.getName());
|
||||
conflicts.putValue(conflictingVariable,
|
||||
PyBundle.message("refactoring.rename.variable.already.defined", newName, pyFile.getName()));
|
||||
}
|
||||
}
|
||||
else if (container instanceof PyClass pyClass) {
|
||||
PyClass conflictingClass = pyClass.findNestedClass(newName, true);
|
||||
if (conflictingClass != null) {
|
||||
conflicts.putValue(conflictingClass, "A class named '" + newName + "' is already defined in class '" + pyClass.getName() + "'");
|
||||
conflicts.putValue(conflictingClass,
|
||||
PyBundle.message("refactoring.rename.nested.class.already.defined", newName, pyClass.getName()));
|
||||
}
|
||||
PyFunction conflictingFunction = pyClass.findMethodByName(newName, true, null);
|
||||
if (conflictingFunction != null) {
|
||||
conflicts.putValue(conflictingFunction, "A function named '" + newName + "' is already defined in class '" + pyClass.getName() + "'");
|
||||
conflicts.putValue(conflictingFunction,
|
||||
PyBundle.message("refactoring.rename.method.already.defined", newName, pyClass.getName()));
|
||||
}
|
||||
PyTargetExpression conflictingAttribute = pyClass.findClassAttribute(newName, true, null);
|
||||
if (conflictingAttribute != null) {
|
||||
conflicts.putValue(conflictingAttribute, "An attribute named '" + newName + "' is already defined in class '" + pyClass.getName() + "'");
|
||||
conflicts.putValue(conflictingAttribute,
|
||||
PyBundle.message("refactoring.rename.class.attribute.already.defined", newName, pyClass.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user