inspection toolwindow: do not enable selected profile as active from toolwindow inspection settings IDEA-156825

This commit is contained in:
Dmitry Batkovich
2016-07-06 18:25:39 +03:00
parent b58dc57487
commit 28fdfc245f
3 changed files with 14 additions and 4 deletions
@@ -104,7 +104,13 @@ public class EditInspectionToolsSettingsAction implements IntentionAction, Icona
final ErrorsConfigurable errorsConfigurable;
if (!canChooseDifferentProfile) {
errorsConfigurable = new ProjectInspectionToolsConfigurable(InspectionProfileManager.getInstance(),
InspectionProjectProfileManager.getInstance(project));
InspectionProjectProfileManager.getInstance(project)) {
@Override
protected boolean setActiveProfileAsDefaultOnApply() {
return false;
}
};
}
else {
errorsConfigurable = ErrorsConfigurable.SERVICE.createConfigurable(project);
@@ -80,7 +80,7 @@ public class EditSettingsAction extends InspectionViewActionBase {
if (toolWrapper != null) {
final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName()); //do not search for dead code entry point tool
if (key != null) {
if (new EditInspectionToolsSettingsAction(key).editToolSettings(view.getProject(), (InspectionProfileImpl)inspectionProfile, true)) {
if (new EditInspectionToolsSettingsAction(key).editToolSettings(view.getProject(), (InspectionProfileImpl)inspectionProfile, false)) {
view.updateCurrentProfile();
}
return;
@@ -88,7 +88,7 @@ public class EditSettingsAction extends InspectionViewActionBase {
}
final String[] path = view.getTree().getSelectedGroupPath();
if (EditInspectionToolsSettingsAction.editSettings(view.getProject(), inspectionProfile, true, (c) -> {
if (EditInspectionToolsSettingsAction.editSettings(view.getProject(), inspectionProfile, false, (c) -> {
if (path != null) {
c.selectInspectionGroup(path);
}
@@ -162,6 +162,10 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
myProfiles.getProfilesComboBox().selectProfile(model);
}
protected boolean setActiveProfileAsDefaultOnApply() {
return true;
}
@Override
public String getDisplayName() {
return DISPLAY_NAME;
@@ -530,7 +534,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
else {
final SingleInspectionProfilePanel panel = getProfilePanel(inspectionProfile);
panel.apply();
if (panel == selectedPanel) {
if (setActiveProfileAsDefaultOnApply() && panel == selectedPanel) {
applyRootProfile(panel.getCurrentProfileName(), panel.isProjectLevel());
}
}