public void visitProblemSeverities(FactoryMap<HighlightDisplayLevel, Integer> counter) {
//do nothing here
}
+
+ @Override
+ public int getProblemCount(boolean allowSuppressed) {
+ return 0;
+ }
}
package com.intellij.codeInspection.ui;
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.InspectionProfile;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.ToolsImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
* @author max
*/
public class InspectionNode extends InspectionTreeNode {
- private final HighlightDisplayKey myKey;
- @NotNull private final InspectionProfile myProfile;
+ @NotNull private final InspectionProfileImpl myProfile;
public InspectionNode(@NotNull InspectionToolWrapper toolWrapper, @NotNull InspectionProfile profile) {
super(toolWrapper);
- myKey = HighlightDisplayKey.find(toolWrapper.getShortName());
- myProfile = profile;
+ myProfile = (InspectionProfileImpl)profile;
}
public String toString() {
@Nullable
@Override
public String getCustomizedTailText() {
- return myProfile.isToolEnabled(myKey) ? null : "Disabled";
- }
-
- @Override
- public int getProblemCount(boolean allowSuppressed) {
- return myKey == null ? 0 : super.getProblemCount(allowSuppressed);
+ final ToolsImpl tools = myProfile.getTools(getToolWrapper().getShortName(), null);
+ return tools.isEnabled() ? null : "Disabled";
}
}
*/
package com.intellij.codeInspection.ui;
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.actions.RunInspectionAction;
-import com.intellij.codeInspection.ex.DisableInspectionToolAction;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.ToolsImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeTable;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBLabelDecorator;
LOG.assertTrue(toolWrapper != null);
InspectionProfileImpl currentProfile =
(InspectionProfileImpl)InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
- HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName());
- boolean enabled = currentProfile.isToolEnabled(key);
+ final ToolsImpl tools = currentProfile.getTools(toolWrapper.getShortName(), project);
+ boolean enabled = tools.isEnabled();
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.LINE_AXIS));
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
- DisableInspectionToolAction.modifyAndCommitProjectProfile(model -> {
- final String toolId = key.toString();
- if (enabled) {
- model.disableTool(toolId, project);
- }
- else {
- ((InspectionProfileImpl)model).enableTool(toolId, project);
- }
- }, project);
+ InspectionsConfigTreeTable.setToolEnabled(!enabled, currentProfile, toolWrapper.getShortName(), project);
+ tree.getContext().getView().profileChanged();
return true;
}
}.installOn(enableButton);
@Override
public void profileChanged(Profile profile) {
if (profile == profileManager.getCurrentProfile()) {
- myTree.revalidate();
- myTree.repaint();
- syncRightPanel();
+ InspectionResultsView.this.profileChanged();
}
}
}, this);
}
+ public void profileChanged() {
+ myTree.revalidate();
+ myTree.repaint();
+ syncRightPanel();
+ }
+
private void initTreeListeners() {
myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public abstract void updateRightPanel();
}
+ public static void setToolEnabled(boolean newState,
+ @NotNull InspectionProfileImpl profile,
+ @NotNull String toolId,
+ @NotNull Project project) {
+ if (newState) {
+ profile.enableTool(toolId, project);
+ }
+ else {
+ profile.disableTool(toolId, project);
+ }
+ for (ScopeToolState scopeToolState : profile.getTools(toolId, project).getTools()) {
+ scopeToolState.setEnabled(newState);
+ }
+ }
+
private static class InspectionsConfigTreeTableModel extends DefaultTreeModel implements TreeTableModel {
private final InspectionsConfigTreeTableSettings mySettings;
final boolean doEnable = (Boolean) aValue;
final InspectionProfileImpl profile = mySettings.getInspectionProfile();
for (final InspectionConfigTreeNode aNode : InspectionsAggregationUtil.getInspectionsNodes((InspectionConfigTreeNode)node)) {
- setToolEnabled(doEnable, profile, aNode.getKey());
+ setToolEnabled(doEnable, profile, aNode.getKey().toString(), mySettings.getProject());
aNode.dropCache();
mySettings.onChanged(aNode);
}
final InspectionProfileImpl profile = mySettings.getInspectionProfile();
for (HighlightDisplayKey tool : tools) {
- setToolEnabled(newState, profile, tool);
+ setToolEnabled(newState, profile, tool.toString(), mySettings.getProject());
}
for (InspectionConfigTreeNode node : nodes) {
}
}
- private void setToolEnabled(boolean newState, InspectionProfileImpl profile, HighlightDisplayKey tool) {
- final String toolId = tool.toString();
- if (newState) {
- profile.enableTool(toolId, mySettings.getProject());
- }
- else {
- profile.disableTool(toolId, mySettings.getProject());
- }
- for (ScopeToolState scopeToolState : profile.getTools(toolId, mySettings.getProject()).getTools()) {
- scopeToolState.setEnabled(newState);
- }
- }
-
private static void collectInspectionFromNodes(final InspectionConfigTreeNode node,
final Set<HighlightDisplayKey> tools,
final List<InspectionConfigTreeNode> nodes) {