Move InspectionMetaDataDialog to reusable location

GitOrigin-RevId: bc72757ec4a2763e252cb87862d3d11e5b69551a
This commit is contained in:
Bas Leijdekkers
2023-04-18 15:21:13 +02:00
committed by intellij-monorepo-bot
parent 02b517002d
commit 90833452bc
6 changed files with 22 additions and 18 deletions

View File

@@ -24,9 +24,6 @@ color.settings.quote.character=Quote escape
color.settings.redundant.escape.sequence=Redundant escape sequence color.settings.redundant.escape.sequence=Redundant escape sequence
color.settings.title.regexp=RegExp color.settings.title.regexp=RegExp
dialog.message.inspection.with.name.exists.warning=Inspection with name ''{0}'' already exists dialog.message.inspection.with.name.exists.warning=Inspection with name ''{0}'' already exists
dialog.message.name.must.not.be.empty=Name must not be empty
dialog.message.suppress.id.must.match.regex.za.z=Suppress ID must match regex [a-zA-Z_0-9.-]+
dialog.title.custom.regexp.inspection=Custom RegExp Inspection
doc.property.block.stands.for.0=Property block stands for {0} doc.property.block.stands.for.0=Property block stands for {0}
doc.property.block.stands.for.characters.not.matching.0=Property block stands for characters not matching {0} doc.property.block.stands.for.characters.not.matching.0=Property block stands for characters not matching {0}
edit.metadata.button=Edit Metadata\u2026 edit.metadata.button=Edit Metadata\u2026
@@ -127,13 +124,9 @@ inspection.warning.unnecessary.non.capturing.group=Unnecessary non-capturing gro
intention.family.name.replace=Replace intention.family.name.replace=Replace
intention.name.check.regexp=Check RegExp intention.name.check.regexp=Check RegExp
label.any=Any label.any=Any
label.description=Description:
label.inspection.name=Inspection name:
label.problem.tool.tip=Problem tool tip (use macro #ref to insert highlighted code):
label.regexp.patterns=RegExp patterns: label.regexp.patterns=RegExp patterns:
label.regexp=&RegExp: label.regexp=&RegExp:
label.sample=&Sample: label.sample=&Sample:
label.suppress.id=Suppress ID:
no.description.provided.description=No description provided no.description.provided.description=No description provided
parse.error.category.shorthand.not.allowed.in.this.regular.expression.dialect=Category shorthand not allowed in this regular expression dialect parse.error.category.shorthand.not.allowed.in.this.regular.expression.dialect=Category shorthand not allowed in this regular expression dialect
parse.error.character.class.expected=Character class expected parse.error.character.class.expected=Character class expected
@@ -185,6 +178,5 @@ tooltip.matches=Expression and example match!
tooltip.more.input.expected=More example input expected tooltip.more.input.expected=More example input expected
tooltip.no.match=Expression and example do not match tooltip.no.match=Expression and example do not match
tooltip.pattern.is.too.complex=Regular expression pattern is too complex tooltip.pattern.is.too.complex=Regular expression pattern is too complex
unnamed.inspection=Unnamed inspection
warning.duplicate.character.0.inside.character.class=Duplicate character ''{0}'' inside character class warning.duplicate.character.0.inside.character.class=Duplicate character ''{0}'' inside character class
warning.duplicate.predefined.character.class.0.inside.character.class=Duplicate predefined character class ''{0}'' inside character class warning.duplicate.predefined.character.class.0.inside.character.class=Duplicate predefined character class ''{0}'' inside character class

View File

@@ -18,6 +18,7 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.profile.codeInspection.ui.InspectionMetaDataDialog;
import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel; import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
import com.intellij.ui.AnActionButton; import com.intellij.ui.AnActionButton;
import com.intellij.ui.DoubleClickListener; import com.intellij.ui.DoubleClickListener;

View File

@@ -19,6 +19,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.ui.InspectionMetaDataDialog;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
import com.intellij.util.SmartList; import com.intellij.util.SmartList;

View File

@@ -323,6 +323,15 @@ power.save.mode.widget.display.name=Power Save Mode
power.save.mode.widget.tooltip.enabled=Power save mode: enabled power.save.mode.widget.tooltip.enabled=Power save mode: enabled
power.save.mode.widget.tooltip.disabled=Power save mode: disabled power.save.mode.widget.tooltip.disabled=Power save mode: disabled
dialog.message.suppress.id.must.match.regex=Suppress ID must match regex [a-zA-Z_0-9.-]+
dialog.message.name.must.not.be.empty=Name must not be empty
dialog.title.user.defined.inspection=User Defined Inspection
label.inspection.name=Inspection name:
label.description=Description:
label.problem.tool.tip=Problem tool tip (use macro #ref to insert highlighted code):
label.suppress.id=Suppress ID:
unnamed.inspection=Unnamed inspection
long.range.set.presentation.empty=unknown long.range.set.presentation.empty=unknown
long.range.set.presentation.any=any value long.range.set.presentation.any=any value
long.range.set.presentation.two.values={0} or {1} long.range.set.presentation.two.values={0} or {1}

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.lang.regexp.inspection.custom; package com.intellij.profile.codeInspection.ui;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.openapi.editor.colors.EditorFontType; import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileType;
@@ -15,7 +16,6 @@ import com.intellij.ui.EditorTextField;
import com.intellij.util.ObjectUtils; import com.intellij.util.ObjectUtils;
import com.intellij.util.SmartList; import com.intellij.util.SmartList;
import com.intellij.util.ui.FormBuilder; import com.intellij.util.ui.FormBuilder;
import org.intellij.lang.regexp.RegExpBundle;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -46,7 +46,7 @@ public class InspectionMetaDataDialog extends DialogWrapper {
@NlsSafe String problemDescriptor, @NlsSafe String problemDescriptor,
@NlsSafe String suppressId) { @NlsSafe String suppressId) {
super(project); super(project);
myNameTextField = new JTextField(name == null ? RegExpBundle.message("unnamed.inspection") : name); myNameTextField = new JTextField(name == null ? InspectionsBundle.message("unnamed.inspection") : name);
myProblemDescriptorTextField = new JTextField(problemDescriptor); myProblemDescriptorTextField = new JTextField(problemDescriptor);
final FileType htmlFileType = FileTypeManager.getInstance().getStdFileType("HTML"); final FileType htmlFileType = FileTypeManager.getInstance().getStdFileType("HTML");
myDescriptionTextArea = new EditorTextField(ObjectUtils.notNull(description, ""), project, htmlFileType); myDescriptionTextArea = new EditorTextField(ObjectUtils.notNull(description, ""), project, htmlFileType);
@@ -56,7 +56,7 @@ public class InspectionMetaDataDialog extends DialogWrapper {
myDescriptionTextArea.setMinimumSize(new Dimension(200, 50)); myDescriptionTextArea.setMinimumSize(new Dimension(200, 50));
mySuppressIdTextField = new JTextField(suppressId); mySuppressIdTextField = new JTextField(suppressId);
myNameValidator = nameValidator; myNameValidator = nameValidator;
setTitle(RegExpBundle.message("dialog.title.custom.regexp.inspection")); setTitle(InspectionsBundle.message("dialog.title.user.defined.inspection"));
init(); init();
} }
@@ -70,7 +70,7 @@ public class InspectionMetaDataDialog extends DialogWrapper {
final List<ValidationInfo> warnings = new SmartList<>(); final List<ValidationInfo> warnings = new SmartList<>();
final String name = getName(); final String name = getName();
if (StringUtil.isEmpty(name)) { if (StringUtil.isEmpty(name)) {
warnings.add(new ValidationInfo(RegExpBundle.message("dialog.message.name.must.not.be.empty"), myNameTextField)); warnings.add(new ValidationInfo(InspectionsBundle.message("dialog.message.name.must.not.be.empty"), myNameTextField));
} }
else { else {
String errorMessage = myNameValidator.apply(name); String errorMessage = myNameValidator.apply(name);
@@ -81,7 +81,7 @@ public class InspectionMetaDataDialog extends DialogWrapper {
final String suppressId = getSuppressId(); final String suppressId = getSuppressId();
if (!StringUtil.isEmpty(suppressId)) { if (!StringUtil.isEmpty(suppressId)) {
if (!mySuppressIdPattern.matcher(suppressId).matches()) { if (!mySuppressIdPattern.matcher(suppressId).matches()) {
warnings.add(new ValidationInfo(RegExpBundle.message("dialog.message.suppress.id.must.match.regex.za.z"), mySuppressIdTextField)); warnings.add(new ValidationInfo(InspectionsBundle.message("dialog.message.suppress.id.must.match.regex"), mySuppressIdTextField));
} }
} }
return warnings; return warnings;
@@ -91,10 +91,10 @@ public class InspectionMetaDataDialog extends DialogWrapper {
@Override @Override
protected JComponent createCenterPanel() { protected JComponent createCenterPanel() {
return new FormBuilder() return new FormBuilder()
.addLabeledComponent(RegExpBundle.message("label.inspection.name"), myNameTextField, true) .addLabeledComponent(InspectionsBundle.message("label.inspection.name"), myNameTextField, true)
.addLabeledComponentFillVertically(RegExpBundle.message("label.description"), myDescriptionTextArea) .addLabeledComponentFillVertically(InspectionsBundle.message("label.description"), myDescriptionTextArea)
.addLabeledComponent(RegExpBundle.message("label.problem.tool.tip"), myProblemDescriptorTextField, true) .addLabeledComponent(InspectionsBundle.message("label.problem.tool.tip"), myProblemDescriptorTextField, true)
.addLabeledComponent(RegExpBundle.message("label.suppress.id"), mySuppressIdTextField) .addLabeledComponent(InspectionsBundle.message("label.suppress.id"), mySuppressIdTextField)
.getPanel(); .getPanel();
} }

View File

@@ -21,6 +21,7 @@ import com.intellij.openapi.util.NlsActions;
import com.intellij.openapi.util.NlsSafe; import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.ui.InspectionMetaDataDialog;
import com.intellij.profile.codeInspection.ui.InspectionProfileActionProvider; import com.intellij.profile.codeInspection.ui.InspectionProfileActionProvider;
import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel; import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
import com.intellij.structuralsearch.SSRBundle; import com.intellij.structuralsearch.SSRBundle;