mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Reset inspection options in Settings isn't saved IDEA-194226
This commit is contained in:
@@ -689,6 +689,15 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
schemeState = SchemeState.POSSIBLY_CHANGED;
|
||||
}
|
||||
|
||||
public void resetToBase(String toolId, NamedScope scope, Project project) {
|
||||
ToolsImpl tools = myBaseProfile.getToolsOrNull(toolId, null);
|
||||
if (tools == null) return;
|
||||
InspectionToolWrapper baseDefaultWrapper = tools.getDefaultState().getTool();
|
||||
ScopeToolState state = myTools.get(toolId).getTools().stream().filter(s -> scope == s.getScope(project)).findFirst().orElseThrow(IllegalStateException::new);
|
||||
state.setTool(copyToolSettings(baseDefaultWrapper));
|
||||
schemeState = SchemeState.POSSIBLY_CHANGED;
|
||||
}
|
||||
|
||||
public void convert(@NotNull Element element, @NotNull Project project) {
|
||||
final Element scopes = element.getChild("scopes");
|
||||
if (scopes == null) {
|
||||
|
||||
+6
-6
@@ -3,6 +3,7 @@ package com.intellij.codeInspection.ex
|
||||
|
||||
import com.intellij.codeInspection.InspectionEP
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
import com.intellij.openapi.options.SchemeState
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.InvalidDataException
|
||||
import com.intellij.openapi.util.WriteExternalException
|
||||
@@ -27,6 +28,11 @@ open class InspectionProfileModifiableModel(val source: InspectionProfileImpl) :
|
||||
modified = value
|
||||
}
|
||||
|
||||
override fun resetToBase(toolId: String?, scope: NamedScope?, project: Project?) {
|
||||
super.resetToBase(toolId, scope, project)
|
||||
setModified(true)
|
||||
}
|
||||
|
||||
override fun copyToolsConfigurations(project: Project?) {
|
||||
copyToolsConfigurations(source, project)
|
||||
}
|
||||
@@ -90,12 +96,6 @@ open class InspectionProfileModifiableModel(val source: InspectionProfileImpl) :
|
||||
myUninitializedSettings.clear()
|
||||
}
|
||||
|
||||
fun resetToBase(toolId: String, scope: NamedScope, project: Project?) {
|
||||
val baseDefaultWrapper = myBaseProfile.getToolsOrNull(toolId, null)?.defaultState?.tool!!
|
||||
val state = myTools[toolId]?.tools?.first { s -> scope == s.getScope(project) }!!
|
||||
state.tool = copyToolSettings(baseDefaultWrapper)
|
||||
}
|
||||
|
||||
//invoke when isChanged() == true
|
||||
fun commit() {
|
||||
source.commit(this)
|
||||
|
||||
Reference in New Issue
Block a user