mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 09:12:22 +07:00
Show inspection profile name in the title when adding or editing custom inspection
GitOrigin-RevId: 0c44686658bd8b5ae3c34672fca983f63f38ad93
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2960f7659b
commit
de38ffbad9
@@ -179,7 +179,8 @@ public class CustomRegExpFakeInspection extends LocalInspectionTool {
|
||||
return;
|
||||
}
|
||||
final CustomRegExpInspection inspection = getRegExpInspection(profile);
|
||||
final InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, myConfiguration);
|
||||
final InspectionMetaDataDialog dialog =
|
||||
inspection.createMetaDataDialog(project, profile.getDisplayName(), myConfiguration);
|
||||
if (isCleanupAllowed()) {
|
||||
dialog.showCleanupOption(myConfiguration.isCleanup());
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class CustomRegExpInspection extends LocalInspectionTool implements Dynam
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public InspectionMetaDataDialog createMetaDataDialog(Project project, @Nullable RegExpInspectionConfiguration configuration) {
|
||||
public InspectionMetaDataDialog createMetaDataDialog(Project project, @NotNull String profileName, @Nullable RegExpInspectionConfiguration configuration) {
|
||||
Function<String, @Nullable @NlsContexts.DialogMessage String> nameValidator = name -> {
|
||||
for (RegExpInspectionConfiguration current : myConfigurations) {
|
||||
if ((configuration == null || !configuration.getUuid().equals(current.getUuid())) &&
|
||||
@@ -199,9 +199,9 @@ public class CustomRegExpInspection extends LocalInspectionTool implements Dynam
|
||||
return null;
|
||||
};
|
||||
if (configuration == null) {
|
||||
return new InspectionMetaDataDialog(project, nameValidator);
|
||||
return new InspectionMetaDataDialog(project, profileName, nameValidator);
|
||||
}
|
||||
return new InspectionMetaDataDialog(project, nameValidator, configuration.getName(), configuration.getDescription(),
|
||||
return new InspectionMetaDataDialog(project, profileName, nameValidator, configuration.getName(), configuration.getDescription(),
|
||||
configuration.getProblemDescriptor(), configuration.getSuppressId());
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ public class RegExpProfileActionProvider extends InspectionProfileActionProvider
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final RegExpDialog dialog = new RegExpDialog(e.getProject(), true, myReplace ? RegExpInspectionConfiguration.InspectionPattern.EMPTY_REPLACE_PATTERN : null);
|
||||
final RegExpDialog dialog =
|
||||
new RegExpDialog(e.getProject(), true, myReplace ? RegExpInspectionConfiguration.InspectionPattern.EMPTY_REPLACE_PATTERN : null);
|
||||
if (!dialog.showAndGet()) return;
|
||||
|
||||
final RegExpInspectionConfiguration.InspectionPattern pattern = dialog.getPattern();
|
||||
@@ -48,7 +49,7 @@ public class RegExpProfileActionProvider extends InspectionProfileActionProvider
|
||||
final CustomRegExpInspection inspection = CustomRegExpInspection.getCustomRegExpInspection(profile);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project == null) return;
|
||||
final InspectionMetaDataDialog metaDataDialog = inspection.createMetaDataDialog(project, null);
|
||||
final InspectionMetaDataDialog metaDataDialog = inspection.createMetaDataDialog(project, profile.getDisplayName(), null);
|
||||
if (pattern.replacement() != null) {
|
||||
metaDataDialog.showCleanupOption(false);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ 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
|
||||
dialog.title.user.defined.inspection=User Defined Inspection in ''{0}''
|
||||
checkbox.cleanup.inspection=&Cleanup inspection
|
||||
label.inspection.name=Inspection name:
|
||||
label.description=&Description:
|
||||
|
||||
@@ -38,11 +38,13 @@ public final class InspectionMetaDataDialog extends DialogWrapper {
|
||||
private boolean showCleanupOption = false;
|
||||
|
||||
public InspectionMetaDataDialog(@NotNull Project project,
|
||||
@NotNull String profileName,
|
||||
@NotNull Function<String, @Nullable @NlsContexts.DialogMessage String> nameValidator) {
|
||||
this(project, nameValidator, null, null, null, null);
|
||||
this(project, profileName, nameValidator, null, null, null, null);
|
||||
}
|
||||
|
||||
public InspectionMetaDataDialog(@NotNull Project project,
|
||||
@NotNull String profileName,
|
||||
@NotNull Function<String, @Nullable @NlsContexts.DialogMessage String> nameValidator,
|
||||
@NlsSafe String name,
|
||||
@NlsSafe String description,
|
||||
@@ -60,7 +62,7 @@ public final class InspectionMetaDataDialog extends DialogWrapper {
|
||||
mySuppressIdTextField = new JTextField(suppressId);
|
||||
myCleanupCheckbox = new JBCheckBox(InspectionsBundle.message("checkbox.cleanup.inspection"));
|
||||
myNameValidator = nameValidator;
|
||||
setTitle(InspectionsBundle.message("dialog.title.user.defined.inspection"));
|
||||
setTitle(InspectionsBundle.message("dialog.title.user.defined.inspection", profileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -286,7 +286,7 @@ public class SSBasedInspection extends LocalInspectionTool implements DynamicGro
|
||||
return removed;
|
||||
}
|
||||
|
||||
public InspectionMetaDataDialog createMetaDataDialog(Project project, @Nullable Configuration configuration) {
|
||||
public InspectionMetaDataDialog createMetaDataDialog(Project project, @NotNull String profileName, @Nullable Configuration configuration) {
|
||||
final List<Configuration> configurations = getConfigurations();
|
||||
final Function<String, @Nullable @NlsContexts.DialogMessage String> nameValidator = name -> {
|
||||
for (Configuration current : configurations) {
|
||||
@@ -298,9 +298,9 @@ public class SSBasedInspection extends LocalInspectionTool implements DynamicGro
|
||||
return null;
|
||||
};
|
||||
if (configuration == null) {
|
||||
return new InspectionMetaDataDialog(project, nameValidator);
|
||||
return new InspectionMetaDataDialog(project, profileName, nameValidator);
|
||||
}
|
||||
return new InspectionMetaDataDialog(project, nameValidator, configuration.getName(), configuration.getDescription(),
|
||||
return new InspectionMetaDataDialog(project, profileName, nameValidator, configuration.getName(), configuration.getDescription(),
|
||||
configuration.getProblemDescriptor(), configuration.getSuppressId());
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public class StructuralSearchFakeInspection extends LocalInspectionTool {
|
||||
return;
|
||||
}
|
||||
final SSBasedInspection inspection = SSBasedInspection.getStructuralSearchInspection(profile);
|
||||
final InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, myMainConfiguration);
|
||||
final InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, profile.getDisplayName(), myMainConfiguration);
|
||||
if (isCleanupAllowed()) {
|
||||
dialog.showCleanupOption(myMainConfiguration.isCleanup());
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class StructuralSearchProfileActionProvider extends InspectionProfileActi
|
||||
@NotNull InspectionProfileImpl profile) {
|
||||
final SSBasedInspection inspection = SSBasedInspection.getStructuralSearchInspection(profile);
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, null);
|
||||
InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, profile.getDisplayName(), null);
|
||||
if (configuration instanceof ReplaceConfiguration) {
|
||||
dialog.showCleanupOption(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user