[i18n] add bundles to java, java.analysis, java.i18n modules and move some properties to them

GitOrigin-RevId: 7ce28e172d977caf53c4c570f17d17c15686f675
This commit is contained in:
nik
2020-02-12 12:42:14 +00:00
committed by intellij-monorepo-bot
parent 24232ac64e
commit 94b05fb068
17 changed files with 111 additions and 19 deletions
@@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
@@ -0,0 +1 @@
inspection.reference.default.package=<default>
@@ -0,0 +1,28 @@
// 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.java.analysis;
import com.intellij.DynamicBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class JavaAnalysisBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaAnalysisBundle";
private static final JavaAnalysisBundle INSTANCE = new JavaAnalysisBundle();
private JavaAnalysisBundle() {
super(BUNDLE);
}
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<String> lazyMessage(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}
@@ -4,10 +4,10 @@ package com.intellij.codeInspection.reference;
import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.codeInspection.BatchSuppressManager;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.SuppressionUtilCore;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
import com.intellij.codeInspection.ex.*;
import com.intellij.java.analysis.JavaAnalysisBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
@@ -166,7 +166,7 @@ public class RefJavaManagerImpl extends RefJavaManager {
public RefPackage getDefaultPackage() {
RefPackage defaultPackage = myCachedDefaultPackage;
if (defaultPackage == null) {
myCachedDefaultPackage = defaultPackage = getPackage(InspectionsBundle.message("inspection.reference.default.package"));
myCachedDefaultPackage = defaultPackage = getPackage(JavaAnalysisBundle.message("inspection.reference.default.package"));
}
return defaultPackage;
}
@@ -386,7 +386,7 @@ public class RefJavaManagerImpl extends RefJavaManager {
String packageName = RefJavaUtil.getInstance().getPackageName(refEntity);
if (packageName != null) {
final Element packageElement = new Element("package");
packageElement.addContent(packageName.isEmpty() ? InspectionsBundle.message("inspection.reference.default.package") : packageName);
packageElement.addContent(packageName.isEmpty() ? JavaAnalysisBundle.message("inspection.reference.default.package") : packageName);
element.addContent(packageElement);
}
}
@@ -2,7 +2,7 @@
package com.intellij.codeInspection.reference;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.java.analysis.JavaAnalysisBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightElement;
@@ -511,7 +511,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
}
RefPackage refPackage = getPackage(refEntity);
return refPackage == null ? InspectionsBundle.message("inspection.reference.default.package") : refPackage.getQualifiedName();
return refPackage == null ? JavaAnalysisBundle.message("inspection.reference.default.package") : refPackage.getQualifiedName();
}
@NotNull
@@ -1,10 +1,10 @@
// 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.codeInsight.daemon.impl;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor;
import com.intellij.java.JavaBundle;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
@@ -14,7 +14,10 @@ import com.intellij.psi.util.ProjectIconsAccessor;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.uast.*;
import org.jetbrains.uast.UCallExpression;
import org.jetbrains.uast.UExpression;
import org.jetbrains.uast.UIdentifier;
import org.jetbrains.uast.UastContextKt;
import org.jetbrains.uast.evaluation.UEvaluationContextKt;
import org.jetbrains.uast.values.*;
@@ -89,7 +92,7 @@ public class IconLineMarkerProvider extends LineMarkerProviderDescriptor {
@NotNull
@Override
public String getName() {
return CodeInsightBundle.message("icon.preview");
return JavaBundle.message("icon.preview");
}
@Override
@@ -1,7 +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.codeInsight.daemon.impl;
import com.intellij.ide.IdeBundle;
import com.intellij.java.JavaBundle;
import com.intellij.lang.Language;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Document;
@@ -262,7 +262,7 @@ public class JavaColorProvider implements ElementColorProvider {
};
}
CommandProcessor.getInstance()
.executeCommand(element.getProject(), command, IdeBundle.message("change.color.command.text"), null, document);
.executeCommand(element.getProject(), command, JavaBundle.message("change.color.command.text"), null, document);
}
private static void replaceInt(PsiExpression expr, int newValue) {
@@ -0,0 +1,2 @@
change.color.command.text=Change color
icon.preview=Icon preview
@@ -0,0 +1,28 @@
// 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.java;
import com.intellij.DynamicBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class JavaBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaBundle";
private static final JavaBundle INSTANCE = new JavaBundle();
private JavaBundle() {
super(BUNDLE);
}
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<String> lazyMessage(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}
@@ -1324,7 +1324,6 @@ inspection.title.capitalization.description=String ''{0}'' is not properly capit
suppress.with.0.comment=Suppress with ''{0}'' comment
if.the.resource.bundle.is.invalid.either.declare.it.as.an.object=If the resource bundle is invalid, either declare it as an object of the java.util.ResourceBundle class in the source code, or edit the internationalization template to point to the method of your custom resource bundle class.
searching.for.duplicates.of.0=Searching for Duplicates of ''{0}''
property.file=Property file:
property.has.no.usages=Property has no usages
property.has.non.method.usages=Property has non-method usages
@@ -161,7 +161,6 @@ inspection.i18n.message.general.with.value=Hardcoded string literal: {0}
inspection.unresolved.property.key.reference.name=Invalid property key
inspection.unresolved.property.key.reference.message=String literal ''{0}'' doesn''t appear to be valid property key
inspection.invalid.resource.bundle.reference=Invalid resource bundle reference ''{0}''
i18nize.dialog.title=I18nize Hardcoded String
i18nize.dialog.error.jdk.message=Class 'java.util.ResourceBundle' cannot be found.\nPlease setup correct JDK.
i18nize.dialog.error.jdk.title=Class Not Found
i18nize.dialog.property.file.chooser.title=Choose Properties File
@@ -763,7 +762,6 @@ convert.path.to.0=Convert path to {0}
convert.0.path.to.1=Convert {0} path to {1}
move.it=move it
choose.0.parameters=Choose {0} Parameters
icon.preview=Icon preview
generate.hashcode.template.title=HashCode Template:
generate.equals.template.title=Equals Template:
postfix.template.language.level.title=Minimum language level:
@@ -0,0 +1 @@
property.file=Property file:
@@ -3,10 +3,11 @@
// found in the LICENSE file.
package com.intellij.codeInspection.i18n;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInspection.*;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.java.i18n.JavaI18nBundle;
import com.intellij.lang.Language;
import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.lang.properties.PropertiesImplUtil;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.lang.properties.references.I18nUtil;
@@ -244,7 +245,7 @@ public class I18nizeBatchQuickFix extends I18nizeQuickFix implements BatchQuickF
super(project, true);
myProject = project;
myKeyValuePairs = keyValuePairs;
setTitle(CodeInsightBundle.message("i18nize.dialog.title"));
setTitle(PropertiesBundle.message("i18nize.dialog.title"));
init();
}
@@ -260,7 +261,7 @@ public class I18nizeBatchQuickFix extends I18nizeQuickFix implements BatchQuickF
myPropertiesFile = new ComboBox<>(ArrayUtil.toStringArray(files));
new ComboboxSpeedSearch(myPropertiesFile);
LabeledComponent<JComboBox<String>> component = new LabeledComponent<>();
component.setText(InspectionsBundle.message("property.file"));
component.setText(JavaI18nBundle.message("property.file"));
component.setComponent(myPropertiesFile);
myPropertiesFile.addActionListener(new ActionListener() {
@Override
@@ -0,0 +1,28 @@
// 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.java.i18n;
import com.intellij.DynamicBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class JavaI18nBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaI18nBundle";
private static final JavaI18nBundle INSTANCE = new JavaI18nBundle();
private JavaI18nBundle() {
super(BUNDLE);
}
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<String> lazyMessage(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}
@@ -1,7 +1,7 @@
// Copyright 2000-2019 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 org.jetbrains.plugins.javaFX.fxml.codeInsight;
import com.intellij.ide.IdeBundle;
import com.intellij.java.JavaBundle;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.ElementColorProvider;
@@ -212,7 +212,7 @@ public class JavaFxColorProvider implements ElementColorProvider {
if (command != null) {
Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile());
CommandProcessor.getInstance()
.executeCommand(element.getProject(), command, IdeBundle.message("change.color.command.text"), null, document);
.executeCommand(element.getProject(), command, JavaBundle.message("change.color.command.text"), null, document);
}
}
@@ -27,6 +27,7 @@ unused.message.format.parameter.problem.descriptor=Using parameter {0} without u
unresolved.property.key=Cannot resolve property key
unused.property.suppress.for.property=Suppress for this property
unused.property.suppress.for.file=Suppress for whole file
i18nize.dialog.title=I18nize Hardcoded String
# suppress inspection "UnusedProperty"
action.I18nize.text=Internationali_ze...
# suppress inspection "UnusedProperty"
@@ -10,6 +10,7 @@ import com.intellij.ide.util.TreeFileChooser;
import com.intellij.ide.util.TreeFileChooserFactory;
import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.LastSelectedPropertiesFileStore;
import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.lang.properties.PropertiesImplUtil;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.application.ApplicationManager;
@@ -117,7 +118,7 @@ public class I18nizeQuickFixDialog extends DialogWrapper implements I18nizeQuick
myDefaultPropertyValue = defaultPropertyValue;
myCustomization = customization != null ? customization:new DialogCustomization();
setTitle(myCustomization.title != null ? myCustomization.title:CodeInsightBundle.message("i18nize.dialog.title"));
setTitle(myCustomization.title != null ? myCustomization.title : PropertiesBundle.message("i18nize.dialog.title"));
myPropertiesFile = new TextFieldWithHistory();
myPropertiesFile.setHistorySize(-1);