i18n warnings fixed

GitOrigin-RevId: 0d579ccd324157eb17fd9bb85d1ac49cf617992d
This commit is contained in:
Tagir Valeev
2024-06-25 16:46:42 +02:00
committed by intellij-monorepo-bot
parent 2c31e99a77
commit f905b1965e
10 changed files with 37 additions and 28 deletions

View File

@@ -15,6 +15,7 @@
*/
package com.intellij.formatting;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -133,7 +134,7 @@ public interface Block {
* @return debug name, or null for default one.
*/
@Nullable
default String getDebugName() {
default @NlsSafe String getDebugName() {
return null;
}
}

View File

@@ -3120,3 +3120,4 @@ title.region.not_set=Not specified
ijent.wsl.fs.dialog.message=Please restart the IDE to automatically apply the necessary VM options
ijent.wsl.fs.dialog.title=VM Options For WSL File System Through Remote Agent
product.and.plugin={0} and {1} plugin

View File

@@ -36,6 +36,7 @@ import com.intellij.util.SlowOperationCanceledException
import com.intellij.util.SlowOperations
import com.intellij.util.concurrency.annotations.RequiresBlockingContext
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.NonNls
import java.awt.Component
import java.awt.event.*
@@ -70,7 +71,7 @@ object ActionUtil {
@JvmField
@Suppress("DEPRECATION", "removal")
val SECONDARY_TEXT: Key<String> = Presentation.PROP_VALUE
val SECONDARY_TEXT: Key<@Nls String> = Presentation.PROP_VALUE
@JvmField
val SEARCH_TAG: Key<String?> = Key.create<@NonNls String?>("SEARCH_TAG")

View File

@@ -17,6 +17,7 @@ import com.intellij.ui.components.*
import com.intellij.util.ui.JBFont
import com.intellij.util.ui.UIUtil
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
import java.awt.Component
import java.awt.Dimension
import java.awt.event.ActionEvent
@@ -297,7 +298,7 @@ abstract class Cell : BaseBuilder {
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
fun link(@LinkLabel text: String,
fun link(text: @LinkLabel String,
style: UIUtil.ComponentStyle? = null,
action: () -> Unit): CellBuilder<JComponent> {
val result = Link(text, style, action)
@@ -306,14 +307,14 @@ abstract class Cell : BaseBuilder {
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
fun browserLink(@LinkLabel text: String, url: String): CellBuilder<JComponent> {
fun browserLink(text: @LinkLabel String, url: String): CellBuilder<JComponent> {
val result = BrowserLink(text, url)
return component(result)
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
fun button(@Button text: String, actionListener: (event: ActionEvent) -> Unit): CellBuilder<JButton> {
fun button(text: @Button String, actionListener: (event: ActionEvent) -> Unit): CellBuilder<JButton> {
val button = JButton(BundleBase.replaceMnemonicAmpersand(text))
button.addActionListener(actionListener)
return component(button)
@@ -321,9 +322,9 @@ abstract class Cell : BaseBuilder {
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
inline fun checkBox(@Checkbox text: String,
inline fun checkBox(text: @Checkbox String,
isSelected: Boolean = false,
@DetailedDescription comment: String? = null,
comment: @DetailedDescription String? = null,
crossinline actionListener: (event: ActionEvent, component: JCheckBox) -> Unit): CellBuilder<JBCheckBox> {
return checkBox(text, isSelected, comment)
.applyToComponent {
@@ -364,9 +365,9 @@ abstract class Cell : BaseBuilder {
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
fun checkBox(@Checkbox text: String,
fun checkBox(text: @Checkbox String,
property: GraphProperty<Boolean>,
@DetailedDescription comment: String? = null): CellBuilder<JBCheckBox> {
comment: @DetailedDescription String? = null): CellBuilder<JBCheckBox> {
val component = JBCheckBox(text, property.get())
return component(comment = comment).withGraphProperty(property).applyToComponent { component.bind(property) }
}
@@ -429,7 +430,7 @@ abstract class Cell : BaseBuilder {
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2")
fun textField(binding: PropertyBinding<String>, columns: Int? = null): CellBuilder<JBTextField> {
fun textField(binding: PropertyBinding<@Nls String>, columns: Int? = null): CellBuilder<JBTextField> {
return component(JBTextField(binding.get(), columns ?: 0))
.withBindingInt(JTextComponent::getText, JTextComponent::setText, binding)
}

View File

@@ -52,7 +52,7 @@ interface RowBuilder : BaseBuilder {
*/
@ApiStatus.ScheduledForRemoval
@Deprecated("Use Kotlin UI DSL Version 2", level = DeprecationLevel.HIDDEN)
fun noteRow(@Nls text: String, linkHandler: ((url: String) -> Unit)? = null) {
fun noteRow(text: @Nls String, linkHandler: ((url: String) -> Unit)? = null) {
createNoteOrCommentRow(noteComponent(text, linkHandler))
}

View File

@@ -134,7 +134,7 @@ private fun loadAndParseTip(tip: TipAndTrickBean?, contextComponent: Component?,
return paragraphs
}
private data class LoadedTipInfo(val tipContent: String,
private data class LoadedTipInfo(val tipContent: @Nls String,
val imagesLocation: String? = null,
val tipContentLoader: ClassLoader? = null,
val tipImagesLoader: ClassLoader? = tipContentLoader)
@@ -147,7 +147,7 @@ private fun loadTip(tip: TipAndTrickBean?, isStrict: Boolean): LoadedTipInfo {
try {
val tipFile = Path.of(tip.fileName)
if (tipFile.isAbsolute && Files.exists(tipFile)) {
val content = Files.readString(tipFile)
@Suppress("HardCodedStringLiteral") val content = Files.readString(tipFile)
return LoadedTipInfo(content, tipFile.parent.toString())
}
else {
@@ -313,11 +313,12 @@ private fun handleError(t: Throwable, isStrict: Boolean) {
}
}
private fun getCantReadText(bean: TipAndTrickBean): String {
private fun getCantReadText(bean: TipAndTrickBean): @Nls String {
val plugin = getPoweredByText(bean)
var product = ApplicationNamesInfo.getInstance().fullProductName
if (!plugin.isEmpty()) {
product += " and $plugin plugin"
val product: @Nls String = if (!plugin.isEmpty()) {
IdeBundle.message("product.and.plugin", ApplicationNamesInfo.getInstance().fullProductName, plugin)
} else {
ApplicationNamesInfo.getInstance().fullProductName
}
return IdeBundle.message("error.unable.to.read.tip.of.the.day", bean.fileName, product)
}
@@ -327,20 +328,21 @@ private fun getPoweredByText(tip: TipAndTrickBean): @NlsSafe String {
return if (descriptor == null || PluginManagerCore.CORE_ID == descriptor.pluginId) "" else descriptor.name
}
private class TipEntity(private val name: String, private val value: String) {
fun inline(where: String): String {
private class TipEntity(private val name: @NlsSafe String, private val value: @NlsSafe String) {
fun inline(where: @Nls String): @Nls String {
return where.replace("&$name;", value)
}
}
private class TipRetriever(@JvmField val loader: ClassLoader?, @JvmField val path: String, @JvmField val subPath: String, val suffix: String = "") {
fun getTipContent(tipName: String?): String? {
fun getTipContent(tipName: String?): @Nls String? {
if (tipName == null) {
return null
}
val tipUrl = getTipUrl(tipName) ?: return null
try {
@Suppress("HardCodedStringLiteral")
return ResourceUtil.loadText(tipUrl.openStream())
}
catch (ignored: IOException) {

View File

@@ -5,6 +5,7 @@ import com.intellij.markdown.utils.doc.DocMarkdownToHtmlConverter;
import com.intellij.openapi.project.DefaultProjectFactory;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
/**
@@ -17,13 +18,13 @@ public final class HtmlMarkdownUtils {
}
@Contract(pure = true)
public static @NotNull String toHtml(@NotNull String markdownText) {
public static @NotNull String toHtml(@NotNull @Nls String markdownText) {
return DocMarkdownToHtmlConverter.convert(DefaultProjectFactory.getInstance().getDefaultProject(), markdownText);
}
@Contract(pure = true)
public static @NotNull String toHtml(@NotNull String markdownText, boolean convertTagCodeBlocks) {
public static @NotNull String toHtml(@NotNull @Nls String markdownText, boolean convertTagCodeBlocks) {
return DocMarkdownToHtmlConverter.convert(DefaultProjectFactory.getInstance().getDefaultProject(), markdownText);
}

View File

@@ -16,4 +16,5 @@ tab.title.block.structure=Block Structure
tab.title.references=References
tab.title.stub.structure=Stub Structure
properties.tree.root.description=APIs available for node: base classes and interfaces, common functions
properties.tree.no.selection=PSI tree node is not selected
properties.tree.no.selection=PSI tree node is not selected
separator.psi.tree=P\\&SI Tree

View File

@@ -173,7 +173,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
public PsiViewerDialog(@NotNull Project project, @Nullable Editor selectedEditor) {
super(project, true, IdeModalityType.MODELESS);
myPsiTreePanel = new JPanel(new BorderLayout());
myPsiTreeSeparator = new TitledSeparator("P&SI Tree");
myPsiTreeSeparator = new TitledSeparator(DevPsiViewerBundle.message("separator.psi.tree"));
myPsiTree = new Tree();
myProject = project;
myExternalDocument = selectedEditor != null;
@@ -1035,7 +1035,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider {
.submit(AppExecutorUtil.getAppExecutorService());
}
private @NotNull PsiElement getElementToChooseInPsiTree(@NotNull PsiElement element) {
private static @NotNull PsiElement getElementToChooseInPsiTree(@NotNull PsiElement element) {
if (element.getFirstChild() != null) {
return element;
}

View File

@@ -4,6 +4,7 @@ package com.intellij.dev.psiViewer.formatter;
import com.intellij.formatting.Block;
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.ui.JBColor;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.treeStructure.SimpleNode;
@@ -32,10 +33,10 @@ public final class BlockTreeNode extends SimpleNode {
@Override
protected void update(@NotNull PresentationData presentation) {
String name = myBlock.getDebugName();
@NlsSafe String name = myBlock.getDebugName();
if (name == null) name = myBlock.getClass().getSimpleName();
if (myBlock instanceof DataLanguageBlockWrapper) {
name += " (" + ((DataLanguageBlockWrapper)myBlock).getOriginal().getClass().getSimpleName() + ")";
if (myBlock instanceof DataLanguageBlockWrapper wrapper) {
name += " (" + wrapper.getOriginal().getClass().getSimpleName() + ")";
}
presentation.addText(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);