mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-235533 more @Nls annotations
GitOrigin-RevId: 35e2b787aedf50a738b8c349118ea066fd7267e4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a3962f23f7
commit
828eeb62e1
@@ -28,12 +28,30 @@ public class NlsUI {
|
||||
public @interface Checkbox {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "combobox.item")
|
||||
@Nls(capitalization = Nls.Capitalization.Title)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @interface ComboboxItem {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "checkbox.tooltip")
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @interface CheckboxTooltip {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "tooltip.help")
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @interface Tooltip {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "comment.panel")
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @interface CommentPanel {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "titled.separator")
|
||||
@Nls(capitalization = Nls.Capitalization.Title)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@@ -73,6 +91,12 @@ public class NlsUI {
|
||||
public @interface TextPane {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "text.area")
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @interface TextArea {
|
||||
}
|
||||
|
||||
@NlsContext(prefix = "list.item")
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.mac.foundation.MacUtil;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.nls.NlsContexts;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -32,8 +33,8 @@ public class MessageDialog extends DialogWrapper {
|
||||
private MessagesBorderLayout myLayout;
|
||||
|
||||
public MessageDialog(@Nullable Project project,
|
||||
String message,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String title,
|
||||
@Nls @NlsContexts.DialogMessage String message,
|
||||
@Nls @NlsContexts.DialogTitle String title,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
@Nullable Icon icon,
|
||||
@@ -43,21 +44,21 @@ public class MessageDialog extends DialogWrapper {
|
||||
|
||||
|
||||
public MessageDialog(@Nullable Project project,
|
||||
@Nullable Component parentComponent,
|
||||
String message,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String title,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
@Nullable Icon icon,
|
||||
@Nullable DoNotAskOption doNotAskOption,
|
||||
boolean canBeParent) {
|
||||
@Nullable Component parentComponent,
|
||||
@Nls @NlsContexts.DialogMessage String message,
|
||||
@Nls @NlsContexts.DialogTitle String title,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
@Nullable Icon icon,
|
||||
@Nullable DoNotAskOption doNotAskOption,
|
||||
boolean canBeParent) {
|
||||
super(project, parentComponent, canBeParent, IdeModalityType.IDE);
|
||||
_init(title, message, options, defaultOptionIndex, focusedOptionIndex, icon, doNotAskOption);
|
||||
}
|
||||
|
||||
public MessageDialog(String message,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String title,
|
||||
public MessageDialog(@Nls @NlsContexts.DialogMessage String message,
|
||||
@Nls @NlsContexts.DialogTitle String title,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
@Nullable Icon icon) {
|
||||
@@ -76,8 +77,8 @@ public class MessageDialog extends DialogWrapper {
|
||||
super(project, canBeParent);
|
||||
}
|
||||
|
||||
protected void _init(@Nls(capitalization = Nls.Capitalization.Title) String title,
|
||||
String message,
|
||||
protected void _init(@Nls @NlsContexts.DialogTitle String title,
|
||||
@Nls @NlsContexts.DialogMessage String message,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.util.NlsUI;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PairFunction;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,6 +19,8 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.util.nls.NlsContexts.*;
|
||||
|
||||
/**
|
||||
* Allows to replace the implementation of showing messages. If you, as a plugin developer, need to show
|
||||
* messages, please use the {@link com.intellij.openapi.ui.Messages} class.
|
||||
@@ -24,8 +28,8 @@ import java.util.List;
|
||||
public interface MessagesService {
|
||||
int showMessageDialog(@Nullable Project project,
|
||||
@Nullable Component parentComponent,
|
||||
String message,
|
||||
String title,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
String @NotNull [] options,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
@@ -34,61 +38,79 @@ public interface MessagesService {
|
||||
boolean alwaysUseIdeaUI);
|
||||
|
||||
int showMoreInfoMessageDialog(Project project,
|
||||
String message,
|
||||
String title,
|
||||
String moreInfo,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
@Nls @NlsUI.TextArea String moreInfo,
|
||||
String[] options,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
Icon icon);
|
||||
|
||||
int showTwoStepConfirmationDialog(String message,
|
||||
String title,
|
||||
int showTwoStepConfirmationDialog(@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
String[] options,
|
||||
String checkboxText,
|
||||
@Nls @NlsUI.Checkbox String checkboxText,
|
||||
boolean checked,
|
||||
int defaultOptionIndex,
|
||||
int focusedOptionIndex,
|
||||
Icon icon,
|
||||
PairFunction<? super Integer, ? super JCheckBox, Integer> exitFunc);
|
||||
|
||||
String showPasswordDialog(Project project, String message, String title, Icon icon, InputValidator validator);
|
||||
String showPasswordDialog(Project project,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
Icon icon,
|
||||
InputValidator validator);
|
||||
|
||||
char @Nullable [] showPasswordDialog(@NotNull Component parentComponent, String message, String title, Icon icon, @Nullable InputValidator validator);
|
||||
char @Nullable [] showPasswordDialog(@NotNull Component parentComponent,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
Icon icon,
|
||||
@Nullable InputValidator validator);
|
||||
|
||||
String showInputDialog(@Nullable Project project,
|
||||
@Nullable Component parentComponent,
|
||||
String message,
|
||||
String title,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
@Nullable Icon icon,
|
||||
@Nullable String initialValue,
|
||||
@Nullable @Nls @InputDialogInitialValue String initialValue,
|
||||
@Nullable InputValidator validator,
|
||||
@Nullable TextRange selection,
|
||||
@Nullable String comment);
|
||||
@Nullable @Nls @DialogComment String comment);
|
||||
|
||||
String showMultilineInputDialog(Project project, String message, String title, String initialValue, Icon icon, @Nullable InputValidator validator);
|
||||
String showMultilineInputDialog(Project project,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
@Nls @InputDialogInitialValue String initialValue,
|
||||
Icon icon,
|
||||
@Nullable InputValidator validator);
|
||||
|
||||
Pair<String, Boolean> showInputDialogWithCheckBox(String message,
|
||||
String title,
|
||||
String checkboxText,
|
||||
Pair<String, Boolean> showInputDialogWithCheckBox(@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
@Nls @NlsUI.Checkbox String checkboxText,
|
||||
boolean checked,
|
||||
boolean checkboxEnabled,
|
||||
Icon icon,
|
||||
String initialValue,
|
||||
@Nls @InputDialogInitialValue String initialValue,
|
||||
InputValidator validator);
|
||||
|
||||
String showEditableChooseDialog(String message, String title, Icon icon, String[] values, String initialValue, InputValidator validator);
|
||||
String showEditableChooseDialog(@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
Icon icon,
|
||||
String[] values,
|
||||
@Nls @InputDialogInitialValue String initialValue,
|
||||
InputValidator validator);
|
||||
|
||||
int showChooseDialog(@Nullable Project project,
|
||||
@Nullable Component parentComponent,
|
||||
String message,
|
||||
String title,
|
||||
@Nls @DialogMessage String message,
|
||||
@Nls @DialogTitle String title,
|
||||
String[] values,
|
||||
String initialValue,
|
||||
@Nls @InputDialogInitialValue String initialValue,
|
||||
@Nullable Icon icon);
|
||||
|
||||
void showTextAreaDialog(JTextField textField,
|
||||
String title,
|
||||
@Nls @DialogTitle String title,
|
||||
String dimensionServiceKey,
|
||||
Function<? super String, ? extends List<String>> parser,
|
||||
Function<? super List<String>, String> lineJoiner);
|
||||
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
// 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.openapi.ui.messages;
|
||||
|
||||
import com.intellij.openapi.util.NlsUI;
|
||||
import com.intellij.util.PairFunction;
|
||||
import com.intellij.util.nls.NlsContexts;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -15,10 +17,10 @@ public class TwoStepConfirmationDialog extends MessageDialog {
|
||||
private final boolean myChecked;
|
||||
private final PairFunction<? super Integer, ? super JCheckBox, Integer> myExitFunc;
|
||||
|
||||
public TwoStepConfirmationDialog(String message,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String title,
|
||||
public TwoStepConfirmationDialog(@Nls @NlsContexts.DialogMessage String message,
|
||||
@Nls @NlsContexts.DialogTitle String title,
|
||||
String @NotNull [] options,
|
||||
String checkboxText,
|
||||
@Nls @NlsUI.Checkbox String checkboxText,
|
||||
boolean checked,
|
||||
final int defaultOptionIndexed,
|
||||
final int focusedOptionIndex,
|
||||
|
||||
+17
-10
@@ -5,6 +5,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.ui.ComponentValidator;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.util.NlsUI;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.BrowserHyperlinkListener;
|
||||
@@ -19,6 +20,7 @@ import com.intellij.util.ui.JBEmptyBorder;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -82,7 +84,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
* @param labelText text for the label.
|
||||
* @return <code>this</code>
|
||||
*/
|
||||
public ComponentPanelBuilder withLabel(@NotNull String labelText) {
|
||||
public ComponentPanelBuilder withLabel(@NotNull @Nls @NlsUI.Label String labelText) {
|
||||
myLabelText = labelText;
|
||||
return this;
|
||||
}
|
||||
@@ -107,7 +109,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
* @param comment help context styled text written below the owner component.
|
||||
* @return <code>this</code>
|
||||
*/
|
||||
public ComponentPanelBuilder withComment(@NotNull String comment) {
|
||||
public ComponentPanelBuilder withComment(@NotNull @Nls @NlsUI.CommentPanel String comment) {
|
||||
myCommentText = comment;
|
||||
valid = StringUtil.isEmpty(comment) || StringUtil.isEmpty(myHTDescription);
|
||||
return this;
|
||||
@@ -156,7 +158,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
* @param description help tooltip description.
|
||||
* @return <code>this</code>
|
||||
*/
|
||||
public ComponentPanelBuilder withTooltip(@NotNull String description) {
|
||||
public ComponentPanelBuilder withTooltip(@NotNull @Nls @NlsUI.Tooltip String description) {
|
||||
myHTDescription = description;
|
||||
valid = StringUtil.isEmpty(myCommentText) || StringUtil.isEmpty(description);
|
||||
return this;
|
||||
@@ -171,7 +173,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
*
|
||||
* @return <code>this</code>
|
||||
*/
|
||||
public ComponentPanelBuilder withTooltipLink(@NotNull String linkText, @NotNull Runnable action) {
|
||||
public ComponentPanelBuilder withTooltipLink(@NotNull @Nls @NlsUI.LinkLabel String linkText, @NotNull Runnable action) {
|
||||
myHTLinkText = linkText;
|
||||
myHTAction = action;
|
||||
return this;
|
||||
@@ -261,17 +263,19 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JLabel createCommentComponent(@Nullable String commentText, boolean isCommentBelow) {
|
||||
public static JLabel createCommentComponent(@Nullable @Nls @NlsUI.CommentPanel String commentText, boolean isCommentBelow) {
|
||||
return createCommentComponent(commentText, isCommentBelow, 70);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JLabel createCommentComponent(@Nullable String commentText, boolean isCommentBelow, int maxLineLength) {
|
||||
public static JLabel createCommentComponent(@Nullable @Nls @NlsUI.CommentPanel String commentText, boolean isCommentBelow, int maxLineLength) {
|
||||
return createCommentComponent(() -> new JBLabel(""), commentText, isCommentBelow, maxLineLength);
|
||||
}
|
||||
|
||||
private static JLabel createCommentComponent(@NotNull Supplier<? extends JBLabel> labelSupplier, @Nullable String commentText,
|
||||
boolean isCommentBelow, int maxLineLength) {
|
||||
private static JLabel createCommentComponent(@NotNull Supplier<? extends JBLabel> labelSupplier,
|
||||
@Nullable @Nls @NlsUI.CommentPanel String commentText,
|
||||
boolean isCommentBelow,
|
||||
int maxLineLength) {
|
||||
// todo why our JBLabel cannot render html if render panel without frame (test only)
|
||||
boolean isCopyable = SystemProperties.getBooleanProperty("idea.ui.comment.copyable", true);
|
||||
JLabel component = labelSupplier.get().setCopyable(isCopyable).setAllowAutoWrapping(true);
|
||||
@@ -290,14 +294,17 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder {
|
||||
return component;
|
||||
}
|
||||
|
||||
public static JLabel createNonWrappingCommentComponent(@NotNull String commentText) {
|
||||
public static JLabel createNonWrappingCommentComponent(@NotNull @Nls @NlsUI.CommentPanel String commentText) {
|
||||
JBLabel component = new JBLabel(commentText);
|
||||
component.setForeground(UIUtil.getContextHelpForeground());
|
||||
setCommentFont(component);
|
||||
return component;
|
||||
}
|
||||
|
||||
private static void setCommentText(@NotNull JLabel component, @Nullable String commentText, boolean isCommentBelow, int maxLineLength) {
|
||||
private static void setCommentText(@NotNull JLabel component,
|
||||
@Nullable @Nls @NlsUI.CommentPanel String commentText,
|
||||
boolean isCommentBelow,
|
||||
int maxLineLength) {
|
||||
if (commentText != null) {
|
||||
String css = "<head><style type=\"text/css\">\n" +
|
||||
"a, a:link {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.linkColor()) + ";}\n" +
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.*;
|
||||
import com.intellij.openapi.ui.cellvalidators.*;
|
||||
import com.intellij.openapi.ui.panel.ProgressPanel;
|
||||
import com.intellij.openapi.util.NlsActions;
|
||||
import com.intellij.openapi.util.NlsUI;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
@@ -33,6 +35,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -864,11 +867,11 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
final String myText;
|
||||
final ImmutableList<Item> myChildren;
|
||||
|
||||
Item(@NotNull Icon icon, @NotNull String text) {
|
||||
Item(@NotNull Icon icon, @NotNull @Nls @NlsUI.ComboboxItem String text) {
|
||||
this(icon, text, ImmutableList.of());
|
||||
}
|
||||
|
||||
Item(@NotNull Icon icon, @NotNull String text, @NotNull List<Item> myChildren) {
|
||||
Item(@NotNull Icon icon, @NotNull @Nls @NlsUI.ComboboxItem String text, @NotNull List<Item> myChildren) {
|
||||
this.myIcon = icon;
|
||||
this.myText = text;
|
||||
this.myChildren = ImmutableList.copyOf(myChildren);
|
||||
@@ -966,7 +969,7 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
private static class MyAction extends DumbAwareAction {
|
||||
private MyAction(@Nullable String name, @Nullable Icon icon) {
|
||||
private MyAction(@Nullable @Nls @NlsActions.ActionText String name, @Nullable Icon icon) {
|
||||
super(name, null, icon);
|
||||
}
|
||||
|
||||
@@ -980,7 +983,7 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyAction withDescription(@Nullable String description) {
|
||||
public MyAction withDescription(@Nullable @Nls @NlsActions.ActionDescription String description) {
|
||||
getTemplatePresentation().setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user