SSR: i18n

GitOrigin-RevId: 5946803e5c8e38d3237574bc3aad9425ba59345f
This commit is contained in:
Bas Leijdekkers
2020-01-28 16:39:09 +00:00
committed by intellij-monorepo-bot
parent e1989d6607
commit 8eb1b81cee
12 changed files with 144 additions and 97 deletions
@@ -8,7 +8,6 @@ import com.intellij.codeInspection.ex.InspectionProfileModifiableModel;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.codeInspection.ex.ScopeToolState;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -68,7 +67,7 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
actionGroup.registerCustomShortcutSet(CommonShortcuts.INSERT, panel);
final Presentation presentation = actionGroup.getTemplatePresentation();
presentation.setIcon(AllIcons.General.Add);
presentation.setText(() -> IdeBundle.message("action.presentation.StructuralSearchProfileActionProvider.text"));
presentation.setText(() -> SSRBundle.message("add.inspection.button"));
return Arrays.asList(actionGroup, new RemoveTemplateAction(panel));
}
@@ -77,7 +76,7 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
private final SingleInspectionProfilePanel myPanel;
private RemoveTemplateAction(SingleInspectionProfilePanel panel) {
super("Remove Structural Search && Replace Inspection", null, AllIcons.General.Remove);
super(SSRBundle.message("remove.inspection.button"), null, AllIcons.General.Remove);
myPanel = panel;
registerCustomShortcutSet(CommonShortcuts.getDelete(), myPanel);
}
@@ -199,6 +198,7 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
myDescriptionTextArea.setPreferredSize(new Dimension(375, 125));
myDescriptionTextArea.setMinimumSize(new Dimension(200, 50));
mySuppressIdTextField = new JTextField(configuration.getNewSuppressId());
setTitle(SSRBundle.message("meta.data.dialog.title"));
init();
}
@@ -208,12 +208,12 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
final List<Configuration> configurations = myInspection.getConfigurations();
final String name = getName();
if (StringUtil.isEmpty(name)) {
result.add(new ValidationInfo("Name must not be empty", myNameTextField));
result.add(new ValidationInfo(SSRBundle.message("name.must.not.be.empty.warning"), myNameTextField));
}
else {
for (Configuration configuration : configurations) {
if (configuration.getOrder() == 0 && !configuration.equals(myConfiguration) && configuration.getName().equals(name)) {
result.add(new ValidationInfo("Inspection with name '" + name + "' already exists", myNameTextField));
result.add(new ValidationInfo(SSRBundle.message("inspection.with.name.exists.warning", name), myNameTextField));
break;
}
}
@@ -221,18 +221,18 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
final String suppressId = getSuppressId();
if (!StringUtil.isEmpty(suppressId)) {
if (!mySuppressIdPattern.matcher(suppressId).matches()) {
result.add(new ValidationInfo("Suppress ID must match regex [a-zA-Z_0-9.-]+", mySuppressIdTextField));
result.add(new ValidationInfo(SSRBundle.message("suppress.id.must.match.regex.warning"), mySuppressIdTextField));
}
else {
final HighlightDisplayKey key = HighlightDisplayKey.findById(suppressId);
if (key != null && key != HighlightDisplayKey.find(myConfiguration.getUuid().toString())) {
result.add(new ValidationInfo("Suppress ID '" + suppressId + "' is already in use by another inspection",
result.add(new ValidationInfo(SSRBundle.message("suppress.id.in.use.warning", suppressId),
mySuppressIdTextField));
}
else {
for (Configuration configuration : configurations) {
if (suppressId.equals(configuration.getNewSuppressId())) {
result.add(new ValidationInfo("Suppress ID '" + suppressId + "' is already in use by another inspection",
result.add(new ValidationInfo(SSRBundle.message("suppress.id.in.use.warning", suppressId),
mySuppressIdTextField));
break;
}
@@ -246,12 +246,12 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
@Nullable
@Override
protected JComponent createCenterPanel() {
final FormBuilder builder = new FormBuilder()
.addLabeledComponent("Inspection name:", myNameTextField, true)
.addLabeledComponent("Problem tool tip (use macro #ref to insert highlighted code):", myProblemDescriptorTextField, true)
.addLabeledComponentFillVertically("Description:", myDescriptionTextArea)
.addLabeledComponent("Suppress ID:", mySuppressIdTextField);
return builder.getPanel();
return new FormBuilder()
.addLabeledComponent(SSRBundle.message("inspection.name.label"), myNameTextField, true)
.addLabeledComponent(SSRBundle.message("problem.descriptor.label"), myProblemDescriptorTextField, true)
.addLabeledComponentFillVertically(SSRBundle.message("description.label"), myDescriptionTextArea)
.addLabeledComponent(SSRBundle.message("suppress.id.label"), mySuppressIdTextField)
.getPanel();
}
public String getName() {
@@ -88,7 +88,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
@NotNull
@Override
public String getGroupDisplayName() {
return "Structural Search";
return SSRBundle.message("structural.search.group.name");
}
@Nullable
@@ -96,7 +96,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
public String getStaticDescription() {
final String description = myConfiguration.getDescription();
if (StringUtil.isEmpty(description)) {
return "No description provided";
return SSRBundle.message("no.description.message");
}
return description;
}
@@ -107,7 +107,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
@Override
public @Nullable JComponent createOptionsPanel() {
final JButton button = new JButton("Edit Metadata...");
final JButton button = new JButton(SSRBundle.message("edit.metadata.button"));
button.addActionListener(e -> {
Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(button));
if (project == null) project = ProjectManager.getInstance().getDefaultProject();
@@ -120,7 +120,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
list.setCellRenderer(new ConfigurationCellRenderer());
final JPanel listPanel = ToolbarDecorator.createDecorator(list)
.setAddAction(b -> performAdd(list, b))
.setAddActionName("Add Pattern")
.setAddActionName(SSRBundle.message("add.pattern.action"))
.setRemoveAction(b -> performRemove(list))
.setRemoveActionUpdater(e -> list.getSelectedValuesList().size() < list.getModel().getSize())
.setEditAction(b -> performEdit(list))
@@ -138,7 +138,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
final JPanel panel = new FormBuilder()
.addComponent(button)
.addLabeledComponentFillVertically("Templates:", listPanel)
.addLabeledComponentFillVertically(SSRBundle.message("templates.title"), listPanel)
.getPanel();
panel.setBorder(JBUI.Borders.emptyTop(10));
return panel;
@@ -1,4 +1,4 @@
// 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.
// 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.structuralsearch.plugin.ui;
import com.intellij.find.FindBundle;
@@ -50,8 +50,10 @@ public class DirectoryComboBoxWithButtons extends JPanel {
comboBox.addActionListener(e -> {
if (myUpdating) return;
final VirtualFile directory = getDirectory();
final ComboBox source = (ComboBox)e.getSource();
final ComboBox<?> source = (ComboBox<?>)e.getSource();
if (directory == null) {
//noinspection HardCodedStringLiteral
source.putClientProperty("JComponent.outline", "error");
final Balloon balloon = JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("Not a directory", AllIcons.General.BalloonError, MessageType.ERROR.getPopupBackground(), null)
@@ -60,6 +62,7 @@ public class DirectoryComboBoxWithButtons extends JPanel {
source.requestFocus();
}
else {
//noinspection HardCodedStringLiteral
source.putClientProperty("JComponent.outline", null);
}
if (myCallback != null && directory != null) {
@@ -152,7 +155,9 @@ public class DirectoryComboBoxWithButtons extends JPanel {
private class RecursiveAction extends ToggleAction {
RecursiveAction() {
super(() -> FindBundle.message("find.scope.directory.recursive.checkbox"),
() -> FindBundle.message("find.scope.directory.recursive.checkbox.recursively"), AllIcons.Actions.ShowAsTree);
() -> FindBundle.message("find.recursively.hint"),
AllIcons.Actions.ShowAsTree);
FindBundle.message("find.scope.directory.recursive.checkbox.recursively");
}
@Override
@@ -494,7 +494,7 @@ public class StructuralSearchDialog extends DialogWrapper implements ProjectMana
@Override
protected JComponent createNorthPanel() {
final DefaultActionGroup historyActionGroup =
new DefaultActionGroup(new DumbAwareAction(() -> SSRBundle.message("action.AnActionButton.text.history"), Presentation.NULL_STRING,
new DefaultActionGroup(new DumbAwareAction(() -> SSRBundle.message("history.button"), Presentation.NULL_STRING,
AllIcons.Actions.SearchWithHistory) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
@@ -901,6 +901,7 @@ public class StructuralSearchDialog extends DialogWrapper implements ProjectMana
void reportMessage(@Nullable String message, boolean error, @NotNull JComponent component) {
ApplicationManager.getApplication().invokeLater(() -> {
if (myBalloon != null) myBalloon.hide();
//noinspection HardCodedStringLiteral
component.putClientProperty("JComponent.outline", (!error || message == null) ? null : "error");
component.repaint();
@@ -1178,6 +1179,7 @@ public class StructuralSearchDialog extends DialogWrapper implements ProjectMana
if (editorTextField == null) {
return;
}
@SuppressWarnings("HardCodedStringLiteral")
final Object object = editorTextField.getClientProperty("JComponent.outline");
if ("error".equals(object) || "warning".equals(object)) {
myErrorBorder.paintBorder(c, g, x, y, width, height);
@@ -1294,6 +1296,7 @@ public class StructuralSearchDialog extends DialogWrapper implements ProjectMana
}, myDisposable, myReplace);
editor.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, myConfiguration);
getDocument().putUserData(STRUCTURAL_SEARCH_ERROR_CALLBACK, () -> {
//noinspection HardCodedStringLiteral
putClientProperty("JComponent.outline", "error");
repaint();
getOKAction().setEnabled(false);
@@ -1,4 +1,4 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.psi.PsiElement;
@@ -22,7 +22,7 @@ public class CountFilter extends FilterAction {
boolean myMaxUnlimited;
public CountFilter(FilterTable filterTable) {
super("Count", filterTable);
super(SSRBundle.message("count.filter.name"), filterTable);
}
@Override
@@ -69,7 +69,7 @@ public class CountFilter extends FilterAction {
final MatchVariableConstraint constraint = (MatchVariableConstraint)myTable.getVariable();
final int min = constraint.getMinCount();
final int max = constraint.getMaxCount();
myLabel.append("count=[" + min + "," + (max == Integer.MAX_VALUE ? "∞" : max) + ']');
myLabel.append(SSRBundle.message("count.label", "[" + min + "," + (max == Integer.MAX_VALUE ? "∞" : max) + ']'));
}
@Override
@@ -78,8 +78,8 @@ public class CountFilter extends FilterAction {
private final IntegerField myMinField = new IntegerField();
private final IntegerField myMaxField = new IntegerField();
private final JLabel myMinLabel = new JLabel("min=");
private final JLabel myMaxLabel = new JLabel("max=");
private final JLabel myMinLabel = new JLabel(SSRBundle.message("min.label"));
private final JLabel myMaxLabel = new JLabel(SSRBundle.message("max.label"));
@Override
protected void layoutComponents() {
@@ -126,7 +126,7 @@ public class CountFilter extends FilterAction {
myMaxField.setMinValue(myMinZero ? 0 : 1);
myMaxField.setMaxValue(myMaxUnlimited ? Integer.MAX_VALUE : 1);
myMaxField.setDefaultValue(myMaxUnlimited ? Integer.MAX_VALUE : 1);
myMaxField.setDefaultValueText(myMaxUnlimited ? SSRBundle.message("editvarcontraints.unlimited") : "1");
myMaxField.setDefaultValueText(myMaxUnlimited ? SSRBundle.message("unlimited.placeholder") : "1");
final int maxCount = myConstraint.getMaxCount();
if (!isDefaultValue(maxCount)) {
myMaxField.setValue(maxCount);
@@ -1,10 +1,11 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.psi.PsiElement;
import com.intellij.ui.SimpleColoredComponent;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -24,7 +25,7 @@ public abstract class FilterAction extends AnAction implements Filter {
private boolean myApplicable = true;
protected FilterAction(@Nullable String text, FilterTable table) {
protected FilterAction(@Nls @Nullable String text, FilterTable table) {
super(text);
myTable = table;
myPosition = myFilterCount.incrementAndGet();
@@ -1,4 +1,4 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.ide.DataManager;
@@ -12,6 +12,7 @@ import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.MatchVariableConstraint;
import com.intellij.structuralsearch.NamedScriptableDefinition;
import com.intellij.structuralsearch.SSRBundle;
import com.intellij.structuralsearch.StructuralSearchProfile;
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
import com.intellij.structuralsearch.plugin.ui.Configuration;
@@ -181,7 +182,7 @@ public class FilterPanel implements FilterTable {
if (myConstraint instanceof MatchVariableConstraint) {
final DefaultActionGroup group = new DefaultActionGroup(myFilters);
final DataContext context = DataManager.getInstance().getDataContext(component);
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Add Filter", group, context,
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(SSRBundle.message("add.filter.label"), group, context,
JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true,
null);
popup.show(point);
@@ -234,16 +235,18 @@ public class FilterPanel implements FilterTable {
final String message;
if (constraint instanceof MatchVariableConstraint) {
message = Configuration.CONTEXT_VAR_NAME.equals(varName)
? "No filters added for the whole template."
: "No filters added for $" + varName + "$.";
? SSRBundle.message("no.filters.whole.template.label")
: SSRBundle.message("no.filters.for.label", varName);
}
else {
message = "No script added for $" + varName + "$.";
message = SSRBundle.message("no.script.for.label", varName);
}
final StatusText statusText = myFilterTable.getTable().getEmptyText();
statusText.setText(message);
if (myValid) {
statusText.appendSecondaryText(myConstraint instanceof MatchVariableConstraint ? "Add filter" : "Add script",
statusText.appendSecondaryText(myConstraint instanceof MatchVariableConstraint
? SSRBundle.message("add.filter.label")
: SSRBundle.message("add.script.label"),
SimpleTextAttributes.LINK_ATTRIBUTES,
e -> {
final JBTable table = myFilterTable.getTable();
@@ -277,8 +280,8 @@ public class FilterPanel implements FilterTable {
myLabel.clear();
final String varName = myConstraint.getName();
myLabel.append(Configuration.CONTEXT_VAR_NAME.equals(varName)
? "Filters for the whole template:"
: "Filters for $" + varName + "$:",
? SSRBundle.message("filters.whole.template.title")
: SSRBundle.message("no.filters.for.label", varName),
SimpleTextAttributes.GRAYED_ATTRIBUTES);
return myLabel;
}
@@ -1,4 +1,4 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.openapi.actionSystem.ActionManager;
@@ -8,6 +8,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.MatchVariableConstraint;
import com.intellij.structuralsearch.NamedScriptableDefinition;
import com.intellij.structuralsearch.SSRBundle;
import com.intellij.structuralsearch.plugin.ui.ConfigurationManager;
import com.intellij.structuralsearch.plugin.ui.UIUtil;
import com.intellij.ui.ContextHelpLabel;
@@ -24,7 +25,7 @@ import java.util.List;
public class ReferenceFilter extends FilterAction {
public ReferenceFilter(FilterTable filterTable) {
super("Reference", filterTable);
super(SSRBundle.message("reference.filter.name"), filterTable);
}
@Override
@@ -66,15 +67,12 @@ public class ReferenceFilter extends FilterAction {
public FilterEditor getEditor() {
return new FilterEditor<MatchVariableConstraint>(myTable.getVariable(), myTable.getConstraintChangedCallback()) {
private final JLabel myLabel = new JLabel("reference=");
private final JLabel myLabel = new JLabel(SSRBundle.message("reference.label"));
private final TextFieldWithAutoCompletion<String> textField =
TextFieldWithAutoCompletion.create(myTable.getProject(), Collections.emptyList(), false, "");
private final String shortcut =
KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(
"<p>Preconfigured search patterns can be autocompleted with " +
shortcut + ".<p>The referenced element is checked against the provided pattern.\n\n" +
"<p>Use \"!\" to invert the pattern.");
private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("reference.filter.help.text", shortcut));
@Override
protected void layoutComponents() {
@@ -1,10 +1,11 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.MatchVariableConstraint;
import com.intellij.structuralsearch.NamedScriptableDefinition;
import com.intellij.structuralsearch.SSRBundle;
import com.intellij.structuralsearch.impl.matcher.predicates.ScriptLog;
import com.intellij.structuralsearch.plugin.ui.Configuration;
import com.intellij.structuralsearch.plugin.ui.UIUtil;
@@ -25,7 +26,7 @@ import java.util.List;
public class ScriptFilter extends FilterAction {
public ScriptFilter(FilterTable filterTable) {
super("Script", filterTable);
super(SSRBundle.message("script.filter.name"), filterTable);
}
@Override
@@ -52,7 +53,7 @@ public class ScriptFilter extends FilterAction {
public FilterEditor getEditor() {
return new FilterEditor<NamedScriptableDefinition>(myTable.getVariable(), myTable.getConstraintChangedCallback()) {
private final JLabel myLabel = new JLabel("script=");
private final JLabel myLabel = new JLabel(SSRBundle.message("script.label"));
private final EditorTextField myTextField = UIUtil.createScriptComponent("", myTable.getProject());
private ContextHelpLabel myHelpLabel;
@@ -69,18 +70,12 @@ public class ScriptFilter extends FilterAction {
};
final String[] variableNames = {Configuration.CONTEXT_VAR_NAME, ScriptLog.SCRIPT_LOG_VAR_NAME};
final String variableText = "<p>Available variables: " + String.join(", ", variableNames);
final String variableText = String.join(", ", variableNames);
if (myConstraint instanceof MatchVariableConstraint) {
myHelpLabel = ContextHelpLabel.create(
"<p>Use the GroovyScript IntelliJ API to filter the search results. " +
"When the specified script returns <code>false</code>, the found element will not be in the search results. " +
"Non-boolean script results will be converted to boolean." + variableText);
myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.match.variable.help.text", variableText));
}
else {
myHelpLabel = ContextHelpLabel.create(
"<p>Use the GroovyScript Intellij API to create a custom replacement, for advanced renaming, rewriting or refactoring. " +
"When replacing, the variable in the replace template will be replaced with the String result of the specified script. " +
variableText);
myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.replacement.variable.help.text", variableText));
}
final GroupLayout layout = new GroupLayout(this);
@@ -1,10 +1,11 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.MatchVariableConstraint;
import com.intellij.structuralsearch.NamedScriptableDefinition;
import com.intellij.structuralsearch.SSRBundle;
import com.intellij.structuralsearch.StructuralSearchProfile;
import com.intellij.structuralsearch.plugin.ui.UIUtil;
import com.intellij.ui.ContextHelpLabel;
@@ -23,7 +24,7 @@ public class TextFilter extends FilterAction {
boolean myShowHierarchy;
public TextFilter(FilterTable filterTable) {
super("Text", filterTable);
super(SSRBundle.message("text.filter.name"), filterTable);
}
@Override
@@ -73,13 +74,11 @@ public class TextFilter extends FilterAction {
return new FilterEditor<MatchVariableConstraint>(myTable.getVariable(), myTable.getConstraintChangedCallback()) {
private final EditorTextField myTextField = UIUtil.createRegexComponent("", myTable.getProject());
private final JCheckBox myWordsCheckBox = new JCheckBox("Words", false);
private final JCheckBox myHierarchyCheckBox = new JCheckBox("Within type hierarchy", false);
private final JLabel myTextLabel = new JLabel("text=");
private final JCheckBox myWordsCheckBox = new JCheckBox(SSRBundle.message("whole.words.check.box"), false);
private final JCheckBox myHierarchyCheckBox = new JCheckBox(SSRBundle.message("within.type.hierarchy.check.box"), false);
private final JLabel myTextLabel = new JLabel(SSRBundle.message("text.label"));
private final ContextHelpLabel myHelpLabel =
ContextHelpLabel.create("<p>Text of the match is checked against the provided pattern." +
"<p>Use \"!\" to invert the pattern." +
"<p>Regular expressions are supported.");
ContextHelpLabel.create(SSRBundle.message("text.filter.help.text"));
@Override
protected void layoutComponents() {
@@ -1,4 +1,4 @@
// 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.
// 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.structuralsearch.plugin.ui.filters;
import com.intellij.openapi.fileTypes.PlainTextFileType;
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.MatchVariableConstraint;
import com.intellij.structuralsearch.NamedScriptableDefinition;
import com.intellij.structuralsearch.SSRBundle;
import com.intellij.structuralsearch.StructuralSearchProfile;
import com.intellij.structuralsearch.plugin.ui.UIUtil;
import com.intellij.ui.ContextHelpLabel;
@@ -25,7 +26,7 @@ public class TypeFilter extends FilterAction {
boolean showRegex;
public TypeFilter(FilterTable filterTable) {
super("Type", filterTable);
super(SSRBundle.message("type.filter.name"), filterTable);
}
@Override
@@ -74,17 +75,15 @@ public class TypeFilter extends FilterAction {
return new FilterEditor<MatchVariableConstraint>(myTable.getVariable(), myTable.getConstraintChangedCallback()) {
private final EditorTextField myTextField = UIUtil.createTextComponent("", myTable.getProject());
private final JLabel myTypeLabel = new JLabel("type=");
private final JCheckBox myHierarchyCheckBox = new JCheckBox("Within type hierarchy", false);
private final JCheckBox myRegexCheckBox = new JCheckBox("Regex", false);
private final JLabel myTypeLabel = new JLabel(SSRBundle.message("type.label"));
private final JCheckBox myHierarchyCheckBox = new JCheckBox(SSRBundle.message("within.type.hierarchy.check.box"), false);
private final JCheckBox myRegexCheckBox = new JCheckBox(SSRBundle.message("regex.check.box"), false);
{
myRegexCheckBox.addActionListener(e -> myTextField.setFileType(myRegexCheckBox.isSelected()
? RegExpFileType.INSTANCE
: PlainTextFileType.INSTANCE));
}
private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(
"<p>The type of the matched expression is checked against the provided \"|\"-separated patterns. " +
"<p>Use \"!\" to invert the pattern.");
private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("type.filter.help.text"));
@Override
protected void layoutComponents() {
@@ -18,8 +18,7 @@ reformat.checkbox=Re&format
use.static.import.checkbox=Use static &imports
search.target.label=Search &target:
edit.variables.button=E&dit Variables...
history.button=&History...
history.button=History
copy.existing.template.button=E&xisting Templates...
open.in.new.tab.checkbox=Open results in new ta&b
@@ -57,6 +56,42 @@ existing.templates.dialog.title=Existing Templates
selecttemplate.template.preview=Template preview:
selecttemplate.template.label.please.select.template=<html><body><center>Please select a template in the tree on the left.</center></body></html>
# filters
count.filter.name=Count
reference.filter.name=Reference
script.filter.name=Script
text.filter.name=Text
type.filter.name=Type
add.filter.label=Add Filter
add.script.label=Add Script
count.label=count={0}
max.label=max=
min.label=min=
reference.label=reference=
script.label=label=
text.label=text=
type.label=type=
within.type.hierarchy.check.box=Within type hierarchy
whole.words.check.box=Words
regex.check.box=Regex
no.filters.whole.template.label=No filters added for the whole template.
no.filters.for.label=No filters added for ${0}$.
no.script.for.label=No script added for ${0}$.
filters.whole.template.title=Filters for the whole template:
filter.for.title=Filters for ${0}$:
type.filter.help.text=<p>The type of the matched expression is checked against the provided "|"-separated patterns. <p>Use "!" to invert the pattern.
text.filter.help.text=<p>Text of the match is checked against the provided pattern. <p>Use "!" to invert the pattern. <p>Regular expressions are supported.
script.filter.match.variable.help.text=<p>Use the GroovyScript IntelliJ API to filter the search results. \
When the specified script returns <code>false</code>, the found element will not be in the search results. \
Non-boolean script results will be converted to boolean. <p>Available variables: {0}
script.filter.replacement.variable.help.text=<p>Use the GroovyScript Intellij API to create a custom replacement, for advanced renaming, \
rewriting or refactoring. When replacing, the variable in the replace template will be replaced with the String result of the specified script. \
<p>Available variables: {0}
reference.filter.help.text=<p>Preconfigured search patterns can be autocompleted with {0}.\
<p>The referenced element is checked against the provided pattern.<p>Use "!" to invert the pattern.
# Replace Dialog specific titles/options
structural.replace.title=Structural Replace
shorten.fully.qualified.names.checkbox=Sh&orten fully qualified names
@@ -168,10 +203,20 @@ predefined.configuration.method.references=method references
predefined.configuration.string.concatenations=string concatenations with many operands
predefined.configuration.deprecated.method.calls=method calls to deprecated methods
predefined.configuration.methods.with.final.parameters=methods \\& constructors with final parameters
predefined.configuration.class.static.blocks=static initializers
predefined.configuration.class.instance.initialization.blocks=instance initializers
predefined.configuration.class.any.initialization.blocks=any initializer
predefined.configuration.logging.without.if=logging without if
predefined.configuration.assert.without.description=assert statement without description
predefined.configuration.class.with.parameterless.constructors=classes with parameterless constructors
predefined.configuration.static.fields.without.final=static fields that are not final
predefined.configuration.sample.method.invokation.with.constant.argument=sample method invocation with constant argument
predefined.configuration.interfaces.having.no.descendants=interface that is not implemented or extended
predefined.configuration.enums=enums
# edit variable constraint dialog options
invalid.regular.expression=Invalid regular expression\: {0}
editvarcontraints.unlimited=Unlimited
unlimited.placeholder=Unlimited
# tooltip message fragment on ss variables
no.constraints.specified.tooltip.message=no constraints specified
@@ -194,14 +239,6 @@ replacement.not.supported.for.filetype=Replacement is not supported for {0} file
search.template.is.not.expression.error.message=A non-expression can not be replaced with an expression
modify.editor.content.command.name=modify editor content
var.constraints.variables.border=Variables
var.constraints.occurrences.count.border=Occurrences count
var.constraints.within.pattern.border=Contained in constraints
var.constraints.script.constraints.border=Script constraints
var.constraints.expression.constraints.border=Expression constraints
var.constraints.text.constraints.border=Text constraints
var.constraints.reference.target.constraints.border=Reference target constraints
different.strategies.for.top.level.nodes.error.message=Different strategies for top level nodes
option.is.not.recognized.error.message=Constraint ''{0}'' not recognized
error.only.one.target.allowed=Only one target allowed
@@ -229,26 +266,33 @@ SSRInspection.display.name=Structural search inspection
SSRInspection.add.search.template.button=Add Search Template...
SSRInspection.add.replace.template.button=Add Replace Template...
SSRInspection.selected.templates=Selected templates:
status.message=Status:
overwrite.message=A template with the same name already exists. Replacing it will overwrite its current contents.
overwrite.title="{0}" Exists, Replace?
template.in.use.message=Template ''{0}'' is used from template ''{1}''. Are you sure you want to remove it?
ssr.will.not.find.anything=The specified pattern does not match anything in scope ''{0}''
predefined.configuration.class.static.blocks=static initializers
predefined.configuration.class.instance.initialization.blocks=instance initializers
predefined.configuration.class.any.initialization.blocks=any initializer
predefined.configuration.logging.without.if=logging without if
predefined.configuration.assert.without.description=assert statement without description
predefined.configuration.class.with.parameterless.constructors=classes with parameterless constructors
predefined.configuration.static.fields.without.final=static fields that are not final
inspection.script.problem={0}\n in Structural Search inspection template ''{1}''
inspection.template.problem=Structural Search inspection problem in template ''{0}''
search.template.problem=Structural Search: {0}
search.script.problem=Structural Search script threw an exception: {0}
complete.match.variable.name=Complete match
predefined.configuration.sample.method.invokation.with.constant.argument=sample method invocation with constant argument
predefined.configuration.interfaces.having.no.descendants=interface that is not implemented or extended
predefined.configuration.enums=enums
regular.expression.help.label=Regular Expressions Help
template.in.use.title=Template ''{0}'' In Use
action.AnActionButton.text.history=History
structural.search.group.name=Structural search
edit.metadata.button=Edit Metadata...
add.pattern.action=Add Pattern
templates.title=Templates:
add.inspection.button=Add Structural Search && Replace Inspection
remove.inspection.button=Remove Structural Search && Replace Inspection
meta.data.dialog.title=Structural Search Inspection
inspection.name.label=Inspection name:
problem.descriptor.label=Problem tool tip (use macro #ref to insert highlighted code):
description.label=Description:
suppress.id.label=Suppress ID:
no.description.message=No description provided
name.must.not.be.empty.warning=Name must not be empty
inspection.with.name.exists.warning=Inspection with name ''{0}'' already exists
suppress.id.must.match.regex.warning=Suppress ID must match regex [a-zA-Z_0-9.-]+
suppress.id.in.use.warning=Suppress ID ''{0}'' is already in use by another inspection