mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 09:12:22 +07:00
Editing of Custom RegExp inspection should happen on a copy (IDEA-318426)
so that changes are not applied when cancelled GitOrigin-RevId: b1b975edc24c5f452adb58b6ab1cff2b50ac5ed3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
90eba4d6d2
commit
6352170061
@@ -246,12 +246,9 @@ public class CustomRegExpFakeInspection extends LocalInspectionTool {
|
||||
saveChangesToProfile(list);
|
||||
}
|
||||
|
||||
private void saveChangesToProfile(JList<InspectionPattern> list) {
|
||||
private static void saveChangesToProfile(JList<InspectionPattern> list) {
|
||||
final InspectionProfileModifiableModel profile = getInspectionProfile(list);
|
||||
if (profile == null) return;
|
||||
final CustomRegExpInspection inspection = getRegExpInspection(profile);
|
||||
inspection.updateConfiguration(myConfiguration);
|
||||
profile.setModified(true);
|
||||
if (profile != null) profile.setModified(true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CustomRegExpInspectionToolWrapper extends LocalInspectionToolWrappe
|
||||
@Override
|
||||
public LocalInspectionToolWrapper createCopy() {
|
||||
final CustomRegExpFakeInspection inspection = (CustomRegExpFakeInspection)getTool();
|
||||
RegExpInspectionConfiguration configuration = inspection.getConfiguration();
|
||||
RegExpInspectionConfiguration configuration = inspection.getConfiguration().copy();
|
||||
return new CustomRegExpInspectionToolWrapper(configuration);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,11 @@ public class RegExpInspectionConfiguration implements Comparable<RegExpInspectio
|
||||
patterns = new SmartList<>();
|
||||
}
|
||||
|
||||
public RegExpInspectionConfiguration(RegExpInspectionConfiguration other) {
|
||||
patterns = new SmartList<>(other.patterns);
|
||||
private RegExpInspectionConfiguration(RegExpInspectionConfiguration other) {
|
||||
patterns = new SmartList<>();
|
||||
for (InspectionPattern pattern : other.patterns) {
|
||||
patterns.add(pattern.copy());
|
||||
}
|
||||
name = other.name;
|
||||
description = other.description;
|
||||
uuid = other.uuid;
|
||||
@@ -180,7 +183,21 @@ public class RegExpInspectionConfiguration implements Comparable<RegExpInspectio
|
||||
public InspectionPattern() {
|
||||
}
|
||||
|
||||
public @NlsSafe String regExp() { return regExp; }
|
||||
InspectionPattern(InspectionPattern copy) {
|
||||
regExp = copy.regExp;
|
||||
fileType = copy.fileType;
|
||||
_fileType = copy._fileType;
|
||||
searchContext = copy.searchContext;
|
||||
replacement = copy.replacement;
|
||||
}
|
||||
|
||||
public InspectionPattern copy() {
|
||||
return new InspectionPattern(this);
|
||||
}
|
||||
|
||||
public @NlsSafe String regExp() {
|
||||
return regExp;
|
||||
}
|
||||
|
||||
public @Nullable FileType fileType() {
|
||||
if (fileType == null && _fileType != null) {
|
||||
@@ -192,9 +209,13 @@ public class RegExpInspectionConfiguration implements Comparable<RegExpInspectio
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public FindModel.SearchContext searchContext() { return searchContext; }
|
||||
public FindModel.SearchContext searchContext() {
|
||||
return searchContext;
|
||||
}
|
||||
|
||||
public @NlsSafe @Nullable String replacement() { return replacement; }
|
||||
public @NlsSafe @Nullable String replacement() {
|
||||
return replacement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
Reference in New Issue
Block a user