mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
i18n java refactorings
GitOrigin-RevId: 61771234023a9baf1f3685e8c383bc99ea0b3ad1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
827335a9c1
commit
29d0109376
+5
-3
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
|
||||
import com.intellij.codeInsight.navigation.NavigationUtil;
|
||||
import com.intellij.codeInspection.AnonymousCanBeLambdaInspection;
|
||||
import com.intellij.ide.util.PsiClassListCellRenderer;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -80,7 +81,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
}
|
||||
|
||||
if (types.isEmpty()) {
|
||||
showErrorMessage(project, editor, "No applicable functional interfaces found");
|
||||
showErrorMessage(project, editor, JavaBundle.message("introduce.functional.variable.nothing.found.message"));
|
||||
return;
|
||||
}
|
||||
if (types.size() == 1 || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
@@ -96,7 +97,8 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
PsiFormatUtil.formatMethod(emptyMethod, PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_TYPE);
|
||||
final PsiType returnType = emptyMethod.getReturnType();
|
||||
assert returnType != null;
|
||||
final String title = "Choose Applicable Functional Interface: " + methodSignature + " -> " + returnType.getPresentableText();
|
||||
final String title =
|
||||
JavaBundle.message("introduce.functional.variable.interface.chooser.title", methodSignature, returnType.getPresentableText());
|
||||
NavigationUtil.getPsiElementPopup(psiClasses, new PsiClassListCellRenderer(), title,
|
||||
psiClass -> {
|
||||
functionalInterfaceSelected(classes.get(psiClass), project, editor, processor, elements);
|
||||
@@ -269,7 +271,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
if (PsiUtil.isLanguageLevel8OrHigher(data.variable)
|
||||
? scope != null && !HighlightControlFlowUtil.isEffectivelyFinal(data.variable, scope, null)
|
||||
: data.variable.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
conflicts.putValue(null, "Variable " + data.name + " is not effectively final and won't be accessible inside functional expression");
|
||||
conflicts.putValue(null, JavaBundle.message("introduce.functional.variable.accessibility.conflict", data.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.intellij.codeInspection.RemoveRedundantTypeArgumentsUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.featureStatistics.ProductivityFeatureNames;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
@@ -539,7 +540,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
public static String getErrorMessage(PsiExpression expr) {
|
||||
final Boolean needParenthesis = expr.getCopyableUserData(NEED_PARENTHESIS);
|
||||
if (needParenthesis != null && needParenthesis.booleanValue()) {
|
||||
return "Extracting selected expression would change the semantic of the whole expression.";
|
||||
return JavaBundle.message("introduce.variable.change.semantics.warning");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-2
@@ -17,6 +17,7 @@ package com.intellij.refactoring.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.intention.impl.TypeExpression;
|
||||
import com.intellij.codeInsight.template.TemplateBuilderImpl;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -405,13 +406,13 @@ public class JavaVariableInplaceIntroducer extends AbstractJavaInplaceIntroducer
|
||||
if (processor.size() > 0) {
|
||||
final Shortcut shortcut = KeymapUtil.getPrimaryShortcut("IntroduceVariable");
|
||||
if (shortcut != null) {
|
||||
return "Press " + KeymapUtil.getShortcutText(shortcut) + " to reassign existing variable";
|
||||
return JavaBundle.message("introduce.variable.reassign.adv", KeymapUtil.getShortcutText(shortcut));
|
||||
}
|
||||
}
|
||||
if (hasTypeSuggestion) {
|
||||
final Shortcut shortcut = KeymapUtil.getPrimaryShortcut("PreviousTemplateVariable");
|
||||
if (shortcut != null) {
|
||||
return "Press " + KeymapUtil.getShortcutText(shortcut) + " to change type";
|
||||
return JavaBundle.message("introduce.variable.change.type.adv", KeymapUtil.getShortcutText(shortcut));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@
|
||||
package com.intellij.refactoring.introduceparameterobject.usageInfo;
|
||||
|
||||
import com.intellij.codeInsight.generation.GenerateMembersUtil;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
@@ -69,7 +70,7 @@ public class AppendAccessorsUsageInfo extends FixableUsageInfo{
|
||||
if (myField != null) {
|
||||
fieldName = myField.getName();
|
||||
}
|
||||
return (myGetter ? "Getter" : "Setter") + " for field '" + fieldName + "' is required";
|
||||
return JavaBundle.message("introduce.parameter.object.no.accessor.conflict.message", myGetter ? 0 : 1, fieldName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.intellij.refactoring.makeStatic;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.TestFrameworks;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -75,7 +76,7 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
|
||||
for (UsageInfo usage : usages) {
|
||||
PsiElement element = usage.getElement();
|
||||
if (element instanceof PsiMethodReferenceExpression && needLambdaConversion((PsiMethodReferenceExpression)element)) {
|
||||
descriptions.putValue(element, "Method reference will be converted to lambda");
|
||||
descriptions.putValue(element, JavaBundle.message("refactoring.method.reference.to.lambda.conflict"));
|
||||
}
|
||||
}
|
||||
return descriptions;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.intellij.refactoring.memberPullUp;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -99,7 +100,8 @@ public final class PullUpConflictsUtil {
|
||||
if (!sClass.isInheritor(subclass, true) && !sClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
for (PsiMethod aMethod : newAbstractMethods) {
|
||||
if (MethodSignatureUtil.findMethodBySignature(sClass, aMethod, true) == null) {
|
||||
conflicts.putValue(sClass, "Concrete '" + RefactoringUIUtil.getDescription(sClass, true) + "' would inherit a new abstract method");
|
||||
conflicts.putValue(sClass, JavaBundle
|
||||
.message("pull.up.concrete.inherit.abstract.method.conflict", RefactoringUIUtil.getDescription(sClass, true)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +123,9 @@ public final class PullUpConflictsUtil {
|
||||
assert qualifiedName != null;
|
||||
if (superClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
|
||||
if (!Comparing.strEqual(StringUtil.getPackageName(qualifiedName), targetPackage.getQualifiedName())) {
|
||||
conflicts.putValue(superClass, RefactoringUIUtil.getDescription(superClass, true) + " won't be accessible from " +RefactoringUIUtil.getDescription(targetPackage, true));
|
||||
conflicts.putValue(superClass, JavaBundle
|
||||
.message("pull.up.accessible.conflict.1", RefactoringUIUtil.getDescription(superClass, true),
|
||||
RefactoringUIUtil.getDescription(targetPackage, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,10 +309,10 @@ public final class PullUpConflictsUtil {
|
||||
if (containingClass != null) {
|
||||
if (!PsiUtil.isAccessibleFromPackage(classMember, myTargetPackage)) {
|
||||
if (classMember.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
|
||||
myConflicts.putValue(myMember, RefactoringUIUtil.getDescription(classMember, true) + " won't be accessible");
|
||||
myConflicts.putValue(myMember, JavaBundle.message("pull.up.accessible.conflict", RefactoringUIUtil.getDescription(classMember, true)));
|
||||
}
|
||||
else if (classMember.hasModifierProperty(PsiModifier.PROTECTED) && !mySubClass.isInheritor(containingClass, true)) {
|
||||
myConflicts.putValue(myMember, RefactoringUIUtil.getDescription(classMember, true) + " won't be accessible");
|
||||
myConflicts.putValue(myMember, JavaBundle.message("pull.up.accessible.conflict", RefactoringUIUtil.getDescription(classMember, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.intellij.refactoring.memberPullUp;
|
||||
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.findUsages.DescriptiveNameUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -294,7 +295,7 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
|
||||
private class PullUpUsageViewDescriptor implements UsageViewDescriptor {
|
||||
@Override
|
||||
public String getProcessedElementsHeader() {
|
||||
return "Pull up members from class " + DescriptiveNameUtil.getDescriptiveName(mySourceClass);
|
||||
return JavaBundle.message("pull.up.members.usage.view.description.processed.elements.node", DescriptiveNameUtil.getDescriptiveName(mySourceClass));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,7 +306,7 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return "Class to pull up members to \"" + RefactoringUIUtil.getDescription(myTargetSuperClass, true) + "\"";
|
||||
return JavaBundle.message("pull.up.members.usage.view.description.code.references.node", RefactoringUIUtil.getDescription(myTargetSuperClass, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.generation.GenerateMembersUtil;
|
||||
import com.intellij.codeInsight.generation.OverrideImplementUtil;
|
||||
import com.intellij.codeInsight.intention.impl.CreateClassDialog;
|
||||
import com.intellij.codeInsight.intention.impl.CreateSubclassAction;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -96,7 +97,7 @@ public class JavaPushDownDelegate extends PushDownDelegate<MemberInfo, PsiMember
|
||||
}
|
||||
if (targetClass instanceof PsiAnonymousClass &&
|
||||
toMove.stream().map(MemberInfoBase::getOverrides).anyMatch(Objects::nonNull)) {
|
||||
conflicts.putValue(targetClass, "Unable to push implements to anonymous class");
|
||||
conflicts.putValue(targetClass, JavaBundle.message("push.down.anonymous.conflict"));
|
||||
}
|
||||
new PushDownConflicts((PsiClass)pushDownData.getSourceClass(), toMove.toArray(new MemberInfo[0]), conflicts)
|
||||
.checkTargetClassConflicts(targetClass, context);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.refactoring.memberPushDown;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -99,7 +100,7 @@ public class PushDownConflicts {
|
||||
if (resolvedClass != null && myClass.isInheritor(resolvedClass, true)) {
|
||||
final PsiMethod methodBySignature = myClass.findMethodBySignature(resolvedMethod, false);
|
||||
if (methodBySignature != null && !myMovedMembers.contains(methodBySignature)) {
|
||||
myConflicts.putValue(expression, "Super method call will resolve to another method");
|
||||
myConflicts.putValue(expression, JavaBundle.message("push.down.super.method.call.changed.conflict"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +112,9 @@ public class PushDownConflicts {
|
||||
Set<PsiClass> unrelatedDefaults = new LinkedHashSet<>();
|
||||
for (PsiMethod superMethod : ((PsiMethod)member).findSuperMethods()) {
|
||||
if (!isAbstract && superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
myConflicts.putValue(member, "Non abstract " + RefactoringUIUtil.getDescription(myClass, false) + " will miss implementation of " + RefactoringUIUtil.getDescription(superMethod, false));
|
||||
myConflicts.putValue(member, JavaBundle
|
||||
.message("push.down.missed.implementation.conflict", RefactoringUIUtil.getDescription(myClass, false),
|
||||
RefactoringUIUtil.getDescription(superMethod, false)));
|
||||
break;
|
||||
}
|
||||
if (superMethod.hasModifierProperty(PsiModifier.DEFAULT)) {
|
||||
@@ -219,7 +222,9 @@ public class PushDownConflicts {
|
||||
if (movedMember.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
PsiUtil.getEnclosingStaticElement(targetClass, null) == null &&
|
||||
!(targetClass.getParent() instanceof PsiFile)) {
|
||||
myConflicts.putValue(movedMember, "Static " + RefactoringUIUtil.getDescription(movedMember, false) + " can't be pushed to non-static " + RefactoringUIUtil.getDescription(targetClass, false));
|
||||
myConflicts.putValue(movedMember, JavaBundle
|
||||
.message("push.down.static.nonstatic.conflict", RefactoringUIUtil.getDescription(movedMember, false),
|
||||
RefactoringUIUtil.getDescription(targetClass, false)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -2,6 +2,7 @@
|
||||
package com.intellij.refactoring.move.moveClassesOrPackages;
|
||||
|
||||
import com.intellij.ide.util.DirectoryChooser;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.DocumentListener;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -67,7 +68,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
|
||||
final Pass<@NlsContexts.DialogMessage String> errorMessageUpdater, final EditorComboBox editorComboBox) {
|
||||
myInitialTargetDirectory = initialTargetDirectory;
|
||||
mySourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(project);
|
||||
String leaveInSameSourceRoot = "Leave in same source root";
|
||||
String leaveInSameSourceRoot = JavaBundle.message("leave.in.same.source.root.item");
|
||||
new ComboboxSpeedSearch(getComboBox()) {
|
||||
@Override
|
||||
protected String getElementText(Object element) {
|
||||
@@ -171,11 +172,11 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
|
||||
final boolean inTestSourceContent = fileIndex.isInTestSourceContent(myInitialTargetDirectory.getVirtualFile());
|
||||
if (isSelectionInTestSourceContent != inTestSourceContent) {
|
||||
if (inTestSourceContent && reportBaseInTestSelectionInSource()) {
|
||||
updateErrorMessage.pass("Source root is selected while the test root is expected");
|
||||
updateErrorMessage.pass(JavaBundle.message("destination.combo.source.root.not.expected.conflict"));
|
||||
}
|
||||
|
||||
if (isSelectionInTestSourceContent && reportBaseInSourceSelectionInTest()) {
|
||||
updateErrorMessage.pass("Test root is selected while the source root is expected");
|
||||
updateErrorMessage.pass(JavaBundle.message("destination.combo.test.root.not.expected.conflict"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -219,7 +219,8 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor {
|
||||
@NotNull
|
||||
protected String getCommandName() {
|
||||
return JavaRefactoringBundle.message("move.class.to.inner.command.name",
|
||||
(myClassesToMove.length > 1 ? "classes " : "class ") + StringUtil.join(myClassesToMove, psiClass -> psiClass.getName(), ", "),
|
||||
myClassesToMove.length,
|
||||
StringUtil.join(myClassesToMove, psiClass -> psiClass.getName(), ", "),
|
||||
myTargetClass.getQualifiedName());
|
||||
}
|
||||
|
||||
@@ -331,9 +332,7 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor {
|
||||
PsiElement container = ConflictsUtil.getContainer(sourceElement);
|
||||
if (!myReportedContainers.contains(container)) {
|
||||
myReportedContainers.add(container);
|
||||
String targetDescription = (targetElement == myClassToMove)
|
||||
? "Class " + CommonRefactoringUtil.htmlEmphasize(myClassToMove.getName())
|
||||
: StringUtil.capitalize(RefactoringUIUtil.getDescription(targetElement, true));
|
||||
String targetDescription = StringUtil.capitalize(RefactoringUIUtil.getDescription(targetElement, true));
|
||||
final String message = JavaRefactoringBundle.message("element.will.no.longer.be.accessible",
|
||||
targetDescription,
|
||||
RefactoringUIUtil.getDescription(container, true));
|
||||
|
||||
+4
-2
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 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.intellij.refactoring.move.moveClassesOrPackages;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -312,11 +313,12 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
if (isMoveToPackage()) {
|
||||
String name = getTargetPackage().trim();
|
||||
if (name.length() != 0 && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) {
|
||||
throw new ConfigurationException("'" + name + "' is invalid destination package name");
|
||||
throw new ConfigurationException(JavaBundle.message("move.classes.invalid.destination.package.name.message", name));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (findTargetClass() == null) throw new ConfigurationException("Destination class not found");
|
||||
if (findTargetClass() == null) throw new ConfigurationException(
|
||||
JavaBundle.message("move.classes.destination.class.not.found.message"));
|
||||
final String validationError = verifyInnerClassDestination();
|
||||
if (validationError != null) throw new ConfigurationException(validationError);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.intellij.refactoring.move.moveInner;
|
||||
|
||||
import com.intellij.ide.util.PackageChooserDialog;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
@@ -54,7 +55,7 @@ public final class MoveInnerImpl {
|
||||
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
|
||||
if (aPackage == null) {
|
||||
if (chooseIfNotUnderSource) {
|
||||
PackageChooserDialog chooser = new PackageChooserDialog("Select Target Package", innerClass.getProject());
|
||||
PackageChooserDialog chooser = new PackageChooserDialog(JavaBundle.message("move.inner.select.target.package.title"), innerClass.getProject());
|
||||
if (!chooser.showAndGet()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@ import com.intellij.codeInsight.ChangeContextUtil;
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
import com.intellij.codeInsight.ExpectedTypesProvider;
|
||||
import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -108,11 +109,11 @@ public class MoveJavaMemberHandler implements MoveMemberHandler {
|
||||
member.hasModifierProperty(PsiModifier.FINAL) &&
|
||||
PsiUtil.isAccessedForWriting((PsiExpression)usageInfo.reference) &&
|
||||
!RefactoringHierarchyUtil.willBeInTargetClass(usageInfo.reference, membersToMove, targetClass, true)) {
|
||||
conflicts.putValue(usageInfo.member, "final variable initializer won't be available after move.");
|
||||
conflicts.putValue(usageInfo.member, JavaBundle.message("move.member.final.initializer.conflict"));
|
||||
}
|
||||
|
||||
if (toBeConvertedToEnum(moveMembersOptions, member, targetClass) && !isEnumAcceptable(element, targetClass)) {
|
||||
conflicts.putValue(element, "Enum type won't be applicable in the current context");
|
||||
conflicts.putValue(element, JavaBundle.message("move.member.enum.conflict"));
|
||||
}
|
||||
|
||||
final PsiReference reference = usageInfo.getReference();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
@@ -42,12 +43,12 @@ public class PsiPackageRenameValidator implements RenameInputValidatorEx {
|
||||
@Override
|
||||
public String getErrorMessage(@NotNull String newName, @NotNull Project project) {
|
||||
if (FileTypeManager.getInstance().isFileIgnored(newName)) {
|
||||
return "Trying to create a package with ignored name, result will not be visible";
|
||||
return JavaBundle.message("rename.package.ignored.name.warning");
|
||||
}
|
||||
|
||||
if (newName.length() > 0) {
|
||||
if (!PsiDirectoryFactory.getInstance(project).isValidPackageName(newName)) {
|
||||
return "Not a valid package name";
|
||||
return JavaBundle.message("rename.package.invalid.name.error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 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.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -107,7 +108,7 @@ public class RenamePsiPackageProcessor extends RenamePsiElementProcessor {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getCommandName() {
|
||||
return "Rename package";
|
||||
return JavaBundle.message("rename.package.command.name");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -146,7 +147,7 @@ public class RenamePsiPackageProcessor extends RenamePsiElementProcessor {
|
||||
final String qualifiedNameAfterRename = getPackageQualifiedNameAfterRename(aPackage, newName, true);
|
||||
final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(qualifiedNameAfterRename, GlobalSearchScope.allScope(project));
|
||||
if (psiClass != null) {
|
||||
conflicts.putValue(psiClass, "Class with qualified name '" + qualifiedNameAfterRename + "' already exist");
|
||||
conflicts.putValue(psiClass, JavaBundle.message("rename.package.class.already.exist.conflict", qualifiedNameAfterRename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,15 +86,15 @@ public class MoveClassToInnerTest extends LightMultiFileTestCase {
|
||||
}
|
||||
|
||||
public void testMoveIntoPackageLocalClass() {
|
||||
doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>pack1.Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
}
|
||||
|
||||
public void testMoveOfPackageLocalClass() {
|
||||
doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>pack1.Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
}
|
||||
|
||||
public void testMoveIntoPrivateInnerClass() {
|
||||
doTestConflicts("pack1.Class1", "pack1.A.PrivateInner", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
doTestConflicts("pack1.Class1", "pack1.A.PrivateInner", "Class <b><code>pack1.Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
|
||||
}
|
||||
|
||||
public void testMoveWithPackageLocalMember() {
|
||||
|
||||
@@ -1374,6 +1374,35 @@ hide.out.of.cyclic.packages.action.text=Hide Packages Without Cyclic Dependencie
|
||||
hide.out.of.cyclic.packages.action.description=Hide packages without cyclic dependencies
|
||||
generate.missed.tests.action.error.no.tests.found=No tests found.
|
||||
generate.missed.tests.action.failed.to.detect.framework=Failed to detect test framework for {0}
|
||||
pull.up.accessible.conflict={0} won''t be accessible
|
||||
pull.up.accessible.conflict.1={0} won''t be accessible from {1}
|
||||
pull.up.concrete.inherit.abstract.method.conflict=Concrete ''{0}'' would inherit a new abstract method
|
||||
pull.up.members.usage.view.description.code.references.node=Class to pull up members to "{0}"
|
||||
pull.up.members.usage.view.description.processed.elements.node=Pull up members from class {0}
|
||||
refactoring.method.reference.to.lambda.conflict=Method reference will be converted to lambda
|
||||
introduce.variable.change.semantics.warning=Extracting selected expression would change the semantic of the whole expression.
|
||||
introduce.variable.change.type.adv=Press {0} to change type
|
||||
introduce.variable.reassign.adv=Press {0} to reassign existing variable
|
||||
introduce.functional.variable.accessibility.conflict=Variable {0} is not effectively final and won''t be accessible inside functional expression
|
||||
introduce.functional.variable.interface.chooser.title=Choose Applicable Functional Interface: {0} -> {1}
|
||||
introduce.functional.variable.nothing.found.message=No applicable functional interfaces found
|
||||
introduce.parameter.object.no.accessor.conflict.message={0, choice, 0#Getter|1#Setter} for field ''{1}'' is required
|
||||
push.down.anonymous.conflict=Unable to push implements to anonymous class
|
||||
push.down.static.nonstatic.conflict=Static {0} can''t be pushed to non-static {1}
|
||||
push.down.missed.implementation.conflict=Non abstract {0} will miss implementation of {1}
|
||||
push.down.super.method.call.changed.conflict=Super method call will resolve to another method
|
||||
move.classes.invalid.destination.package.name.message=''{0}'' is invalid destination package name
|
||||
move.classes.destination.class.not.found.message=Destination class not found
|
||||
destination.combo.test.root.not.expected.conflict=Test root is selected while the source root is expected
|
||||
destination.combo.source.root.not.expected.conflict=Source root is selected while the test root is expected
|
||||
leave.in.same.source.root.item=Leave in same source root
|
||||
move.inner.select.target.package.title=Select Target Package
|
||||
move.member.enum.conflict=Enum type won't be applicable in the current context
|
||||
move.member.final.initializer.conflict=final variable initializer won't be available after move.
|
||||
rename.package.invalid.name.error=Not a valid package name
|
||||
rename.package.ignored.name.warning=Trying to create a package with ignored name, result will not be visible
|
||||
rename.package.class.already.exist.conflict=Class with qualified name ''{0}'' already exist
|
||||
rename.package.command.name=Rename package
|
||||
class.filter.editor.toolbar.button.remove=Remove
|
||||
class.filter.editor.table.model.column.name.pattern=Pattern
|
||||
class.filter.editor.table.model.column.name.isActive=Is Active
|
||||
|
||||
@@ -394,7 +394,7 @@ migration.title=Migration
|
||||
migration.type.column.header=Type
|
||||
move.class=Move Class...
|
||||
move.class.refactoring.cannot.be.applied.to.anonymous.classes=Move Class refactoring cannot be applied to anonymous classes
|
||||
move.class.to.inner.command.name=Move {0} to {1}
|
||||
move.class.to.inner.command.name=Move {0, choice, 1#class|2#classes} {1} to {2}
|
||||
move.class.to.inner.move.to.self.error=It is not allowed to move a class into itself
|
||||
move.class.to.inner.nonstatic.error=It is not allowed to move a class into a non-static inner class
|
||||
move.classes=Move Classes...
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.usageView;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -16,9 +17,11 @@ public interface UsageViewDescriptor {
|
||||
|
||||
String getProcessedElementsHeader();
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
String getCodeReferencesText(int usagesCount, int filesCount);
|
||||
|
||||
@Nls
|
||||
@Nullable
|
||||
default String getCommentReferencesText(int usagesCount, int filesCount) {
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ class GroovyMoveClassToInnerTest extends GroovyMoveTestBase {
|
||||
}
|
||||
|
||||
void testMoveIntoPrivateInnerClass() throws Exception {
|
||||
doTestConflicts("pack1.Class1", "pack1.A.PrivateInner", "Class <b><code>Class1</code></b> will no longer be accessible from class <b><code>pack1.Class2</code></b>")
|
||||
doTestConflicts("pack1.Class1", "pack1.A.PrivateInner", "Class <b><code>pack1.Class1</code></b> will no longer be accessible from class <b><code>pack1.Class2</code></b>")
|
||||
}
|
||||
|
||||
void _testMoveWithPackageLocalMember() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user