mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
HighlightDisplayKey: introduce proper getShortName instead of toString
GitOrigin-RevId: 7c6fb37449dbebb6308c3d76f4cbb48bb3cc1392
This commit is contained in:
committed by
intellij-monorepo-bot
parent
57b9c44e8f
commit
c0f11e5298
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.daemon.impl.analysis;
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
@@ -171,7 +171,7 @@ class UnusedImportsVisitor extends JavaElementVisitor {
|
||||
String description = !predefinedImport ? JavaAnalysisBundle.message("unused.import.statement") :
|
||||
JavaAnalysisBundle.message("text.unused.import.in.template");
|
||||
InspectionProfile profile = getCurrentProfile(myFile);
|
||||
TextAttributesKey key = ObjectUtils.notNull(profile.getEditorAttributes(unusedImportKey.toString(), myFile),
|
||||
TextAttributesKey key = ObjectUtils.notNull(profile.getEditorAttributes(unusedImportKey.getShortName(), myFile),
|
||||
JavaHighlightInfoTypes.UNUSED_IMPORT.getAttributesKey());
|
||||
HighlightInfoType.HighlightInfoTypeImpl configHighlightType =
|
||||
new HighlightInfoType.HighlightInfoTypeImpl(profile.getErrorLevel(unusedImportKey, myFile).getSeverity(), key);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
@@ -43,7 +43,7 @@ public class OfflineInspectionResultViewTest extends TestSourceBasedTestCase {
|
||||
final InspectionProfileImpl profile = new InspectionProfileImpl("test") {
|
||||
@Override
|
||||
public boolean isToolEnabled(final @Nullable HighlightDisplayKey key, PsiElement element) {
|
||||
return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
|
||||
return key != null && Comparing.strEqual(key.getShortName(), UnusedDeclarationInspectionBase.SHORT_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +61,7 @@ public class OfflineInspectionResultViewTest extends TestSourceBasedTestCase {
|
||||
|
||||
@Override
|
||||
public boolean isToolEnabled(@Nullable HighlightDisplayKey key, PsiElement element) {
|
||||
return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
|
||||
return key != null && Comparing.strEqual(key.getShortName(), UnusedDeclarationInspectionBase.SHORT_NAME);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -469,6 +469,7 @@ f:com.intellij.codeInsight.daemon.HighlightDisplayKey
|
||||
- s:getAlternativeID(com.intellij.codeInsight.daemon.HighlightDisplayKey):java.lang.String
|
||||
- s:getDisplayNameByKey(com.intellij.codeInsight.daemon.HighlightDisplayKey):java.lang.String
|
||||
- getID():java.lang.String
|
||||
- getShortName():java.lang.String
|
||||
- s:register(java.lang.String,com.intellij.openapi.util.Computable,java.lang.String):com.intellij.codeInsight.daemon.HighlightDisplayKey
|
||||
- s:register(java.lang.String,com.intellij.openapi.util.Computable,java.lang.String,java.lang.String):com.intellij.codeInsight.daemon.HighlightDisplayKey
|
||||
- s:register(java.lang.String,java.lang.String,java.lang.String):com.intellij.codeInsight.daemon.HighlightDisplayKey
|
||||
|
||||
@@ -158,6 +158,15 @@ public final class HighlightDisplayKey {
|
||||
return myShortName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see LocalInspectionTool#getShortName()
|
||||
*
|
||||
* @return short name of inspection tool
|
||||
*/
|
||||
public String getShortName() {
|
||||
return myShortName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see LocalInspectionTool#getID()
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.Pass;
|
||||
@@ -13,7 +13,10 @@ import com.intellij.codeInspection.ex.InspectionToolWrapper;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.injected.editor.DocumentWindow;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.annotation.*;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
import com.intellij.lang.annotation.ExternalAnnotator;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.lang.annotation.ProblemGroup;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.modcommand.ModCommandAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -766,7 +769,7 @@ public class HighlightInfo implements Segment {
|
||||
myCanCleanup = false;
|
||||
}
|
||||
else {
|
||||
InspectionToolWrapper<?, ?> toolWrapper = profile.getInspectionTool(myKey.toString(), element);
|
||||
InspectionToolWrapper<?, ?> toolWrapper = profile.getInspectionTool(myKey.getShortName(), element);
|
||||
myCanCleanup = toolWrapper != null && toolWrapper.isCleanupTool();
|
||||
}
|
||||
}
|
||||
@@ -806,7 +809,7 @@ public class HighlightInfo implements Segment {
|
||||
IntentionManager intentionManager = IntentionManager.getInstance();
|
||||
List<IntentionAction> newOptions = intentionManager.getStandardIntentionOptions(key, element);
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(element.getProject()).getCurrentProfile();
|
||||
InspectionToolWrapper<?, ?> toolWrapper = profile.getInspectionTool(key.toString(), element);
|
||||
InspectionToolWrapper<?, ?> toolWrapper = profile.getInspectionTool(key.getShortName(), element);
|
||||
if (toolWrapper != null) {
|
||||
myCanCleanup = toolWrapper.isCleanupTool();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
@@ -185,11 +185,13 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
@Override
|
||||
public @NotNull HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey inspectionToolKey, PsiElement element) {
|
||||
Project project = element == null ? null : element.getProject();
|
||||
ToolsImpl tools = getToolsOrNull(inspectionToolKey.toString(), project);
|
||||
ToolsImpl tools = getToolsOrNull(inspectionToolKey.getShortName(), project);
|
||||
HighlightDisplayLevel level = tools != null ? tools.getLevel(element) : HighlightDisplayLevel.WARNING;
|
||||
if (!myProfileManager.getSeverityRegistrar().isSeverityValid(level.getSeverity().getName())) {
|
||||
level = HighlightDisplayLevel.WARNING;
|
||||
setErrorLevel(inspectionToolKey, level, project);
|
||||
if (tools != null) {
|
||||
setErrorLevel(inspectionToolKey, level, project);
|
||||
}
|
||||
}
|
||||
return level;
|
||||
}
|
||||
@@ -708,7 +710,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
}
|
||||
|
||||
private @NotNull HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, @Nullable Project project) {
|
||||
return getTools(key.toString(), project).getLevel();
|
||||
return getTools(key.getShortName(), project).getLevel();
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@@ -757,7 +759,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
}
|
||||
|
||||
public void setErrorLevel(@NotNull HighlightDisplayKey key, @NotNull HighlightDisplayLevel level, Project project) {
|
||||
getTools(key.toString(), project).setLevel(level);
|
||||
getTools(key.getShortName(), project).setLevel(level);
|
||||
mySchemeState = SchemeState.POSSIBLY_CHANGED;
|
||||
}
|
||||
|
||||
@@ -766,7 +768,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
if (key == null) {
|
||||
return false;
|
||||
}
|
||||
Tools toolState = getToolsOrNull(key.toString(), element == null ? null : element.getProject());
|
||||
Tools toolState = getToolsOrNull(key.getShortName(), element == null ? null : element.getProject());
|
||||
return toolState != null && toolState.isEnabled(element);
|
||||
}
|
||||
|
||||
@@ -902,7 +904,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
}
|
||||
|
||||
public boolean isToolEnabled(@NotNull HighlightDisplayKey key, @Nullable NamedScope namedScope, @NotNull Project project) {
|
||||
return getTools(key.toString(), project).isEnabled(namedScope,project);
|
||||
return getTools(key.getShortName(), project).isEnabled(namedScope,project);
|
||||
}
|
||||
|
||||
public void removeScope(@NotNull String toolShortName, @NotNull String scopeName, @NotNull Project project) {
|
||||
@@ -951,13 +953,13 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
|
||||
@Transient
|
||||
public @NotNull HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, @Nullable NamedScope scope, @NotNull Project project) {
|
||||
ToolsImpl tools = getToolsOrNull(key.toString(), project);
|
||||
ToolsImpl tools = getToolsOrNull(key.getShortName(), project);
|
||||
return tools != null ? tools.getLevel(scope, project) : HighlightDisplayLevel.WARNING;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public @Nullable TextAttributesKey getEditorAttributesKey(@NotNull HighlightDisplayKey key, @Nullable NamedScope scope, @NotNull Project project) {
|
||||
ToolsImpl tools = getToolsOrNull(key.toString(), project);
|
||||
ToolsImpl tools = getToolsOrNull(key.getShortName(), project);
|
||||
return tools != null ? tools.getEditorAttributesKey(scope, project) : null;
|
||||
}
|
||||
|
||||
@@ -970,7 +972,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
}
|
||||
|
||||
public void setErrorLevel(@NotNull HighlightDisplayKey key, @NotNull HighlightDisplayLevel level, @Nullable String scopeName, @NotNull Project project) {
|
||||
getTools(key.toString(), project).setLevel(level, scopeName, project);
|
||||
getTools(key.getShortName(), project).setLevel(level, scopeName, project);
|
||||
mySchemeState = SchemeState.POSSIBLY_CHANGED;
|
||||
}
|
||||
|
||||
@@ -982,7 +984,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
|
||||
|
||||
public void setEditorAttributesKey(@NotNull List<? extends HighlightDisplayKey> keys, @Nullable TextAttributesKey attributesKey, @Nullable String scopeName, @NotNull Project project) {
|
||||
for (HighlightDisplayKey key : keys) {
|
||||
setEditorAttributesKey(key.toString(), attributesKey == null ? null : attributesKey.getExternalName(), scopeName, project);
|
||||
setEditorAttributesKey(key.getShortName(), attributesKey == null ? null : attributesKey.getExternalName(), scopeName, project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
@@ -28,7 +28,10 @@ import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectTypeService;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.ProjectInspectionProfileManager;
|
||||
@@ -183,7 +186,7 @@ final class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
HighlightSeverity severity = highlightInfoType.getSeverity(psiElement);
|
||||
TextAttributesKey attributesKey = ((ProblemDescriptorBase)problemDescriptor).getEnforcedTextAttributes();
|
||||
if (problemDescriptor.getHighlightType() == ProblemHighlightType.GENERIC_ERROR_OR_WARNING && attributesKey == null) {
|
||||
attributesKey = myProfileWrapper.getInspectionProfile().getEditorAttributes(key.toString(), getFile());
|
||||
attributesKey = myProfileWrapper.getInspectionProfile().getEditorAttributes(key.getShortName(), getFile());
|
||||
}
|
||||
TextAttributes attributes = attributesKey == null || editorColorsScheme == null || severity.getName().equals(attributesKey.getExternalName())
|
||||
? severityRegistrar.getTextAttributesBySeverity(severity)
|
||||
@@ -406,7 +409,7 @@ final class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
if (((ProblemDescriptorBase)descriptor).getEnforcedTextAttributes() != null) {
|
||||
needEmptyAction = false;
|
||||
}
|
||||
if (needEmptyAction && emptyActionRegistered.add(Pair.create(((ProblemDescriptorBase)descriptor).getTextRange(), key.toString()))) {
|
||||
if (needEmptyAction && emptyActionRegistered.add(Pair.create(((ProblemDescriptorBase)descriptor).getTextRange(), key.getShortName()))) {
|
||||
String displayNameByKey = HighlightDisplayKey.getDisplayNameByKey(key);
|
||||
LOG.assertTrue(displayNameByKey != null, key.toString());
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.actions;
|
||||
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
@@ -40,7 +40,7 @@ public final class RunInspectionIntention implements IntentionAction, HighPriori
|
||||
private final String myShortName;
|
||||
|
||||
public RunInspectionIntention(@NotNull HighlightDisplayKey key) {
|
||||
myShortName = key.toString();
|
||||
myShortName = key.getShortName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
@@ -26,7 +26,7 @@ public class DisableInspectionToolAction extends IntentionAndQuickFixAction impl
|
||||
}
|
||||
|
||||
public DisableInspectionToolAction(final HighlightDisplayKey key) {
|
||||
myToolId = key.toString();
|
||||
myToolId = key.getShortName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
@@ -26,7 +26,7 @@ public final class EditInspectionToolsSettingsAction implements IntentionAction,
|
||||
private final String myShortName;
|
||||
|
||||
public EditInspectionToolsSettingsAction(@NotNull HighlightDisplayKey key) {
|
||||
myShortName = key.toString();
|
||||
myShortName = key.getShortName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.ex
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
@@ -8,7 +8,6 @@ import com.intellij.ui.treeStructure.Tree
|
||||
import com.intellij.util.ui.tree.TreeUtil
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.XCollection
|
||||
import java.util.*
|
||||
import javax.swing.tree.DefaultMutableTreeNode
|
||||
import javax.swing.tree.TreePath
|
||||
|
||||
@@ -71,7 +70,7 @@ internal class VisibleTreeState : BaseState() {
|
||||
var node = _node
|
||||
val expandedNode: State
|
||||
if (node is InspectionConfigTreeNode.Tool) {
|
||||
expandedNode = State(node.key.toString())
|
||||
expandedNode = State(node.key.shortName)
|
||||
}
|
||||
else {
|
||||
val buf = StringBuilder()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.profile.codeInspection.ui;
|
||||
|
||||
import com.intellij.analysis.AnalysisBundle;
|
||||
@@ -192,7 +192,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
final InspectionConfigTreeNode child = (InspectionConfigTreeNode)root.getChildAt(i);
|
||||
if (child instanceof InspectionConfigTreeNode.Tool) {
|
||||
if (((InspectionConfigTreeNode.Tool)child).getKey().toString().equals(name)) {
|
||||
if (((InspectionConfigTreeNode.Tool)child).getKey().getShortName().equals(name)) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
} else if (forceInclude) return false;
|
||||
}
|
||||
for (Set<String> keySet : keySetList) {
|
||||
if (keySet.contains(descriptor.getKey().toString())) {
|
||||
if (keySet.contains(descriptor.getKey().getShortName())) {
|
||||
if (!forceInclude) {
|
||||
return true;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
|
||||
private void loadDescriptorsConfigs(boolean onlyModified) {
|
||||
myInitialToolDescriptors.values().stream().flatMap(ToolDescriptors::getDescriptors).forEach(d -> {
|
||||
if (!onlyModified || myProfile.isProperSetting(d.getKey().toString())) {
|
||||
if (!onlyModified || myProfile.isProperSetting(d.getKey().getShortName())) {
|
||||
d.loadConfig();
|
||||
}
|
||||
});
|
||||
@@ -405,7 +405,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
if (selectionPath != null) {
|
||||
InspectionConfigTreeNode node = (InspectionConfigTreeNode)selectionPath.getLastPathComponent();
|
||||
if (node instanceof InspectionConfigTreeNode.Tool) {
|
||||
final boolean properSetting = myProfile.isProperSetting(((InspectionConfigTreeNode.Tool)node).getKey().toString());
|
||||
final boolean properSetting = myProfile.isProperSetting(((InspectionConfigTreeNode.Tool)node).getKey().getShortName());
|
||||
if (node.isProperSetting() != properSetting) {
|
||||
myAlarm.cancelAllRequests();
|
||||
myAlarm.addRequest(() -> myTreeTable.repaint(), 300);
|
||||
@@ -706,7 +706,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
private boolean includeDoNotShow(Collection<? extends InspectionConfigTreeNode.Tool> nodes) {
|
||||
final Project project = getProject();
|
||||
return !ContainerUtil.exists(nodes, node -> {
|
||||
final InspectionToolWrapper tool = myProfile.getToolDefaultState(node.getKey().toString(), project).getTool();
|
||||
final InspectionToolWrapper tool = myProfile.getToolDefaultState(node.getKey().getShortName(), project).getTool();
|
||||
return tool instanceof GlobalInspectionToolWrapper &&
|
||||
((GlobalInspectionToolWrapper)tool).getSharedLocalInspectionToolWrapper() == null;
|
||||
});
|
||||
@@ -761,7 +761,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
final Project project = getProject();
|
||||
final InspectionConfigTreeNode.Tool singleNode = myTreeTable.getStrictlySelectedToolNode();
|
||||
final ScopeToolState toolState = singleNode != null ?
|
||||
myProfile.getToolDefaultState(singleNode.getDefaultDescriptor().getKey().toString(), project) : null;
|
||||
myProfile.getToolDefaultState(singleNode.getDefaultDescriptor().getKey().getShortName(), project) : null;
|
||||
boolean showDefaultConfigurationOptions = toolState == null || toolState.getTool().getTool().showDefaultConfigurationOptions();
|
||||
if (singleNode != null) {
|
||||
// Inspection tool node selected
|
||||
@@ -803,7 +803,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
|
||||
final Set<String> scopesNames = new HashSet<>();
|
||||
for (final InspectionConfigTreeNode.Tool node : nodes) {
|
||||
final List<ScopeToolState> nonDefaultTools = myProfile.getNonDefaultTools(node.getDefaultDescriptor().getKey().toString(), project);
|
||||
final List<ScopeToolState> nonDefaultTools = myProfile.getNonDefaultTools(node.getDefaultDescriptor().getKey().getShortName(), project);
|
||||
for (final ScopeToolState tool : nonDefaultTools) {
|
||||
scopesNames.add(tool.getScopeName());
|
||||
}
|
||||
@@ -845,7 +845,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
final NamedScope scope = node.getDefaultDescriptor().getScope();
|
||||
final boolean doUpdate = myProfile.getEditorAttributesKey(node.getKey(), scope, project) != key;
|
||||
if (doUpdate) {
|
||||
myProfile.setEditorAttributesKey(node.getKey().toString(), key.getExternalName(), null, project);
|
||||
myProfile.setEditorAttributesKey(node.getKey().getShortName(), key.getExternalName(), null, project);
|
||||
toUpdate.add(node);
|
||||
}
|
||||
}
|
||||
@@ -873,7 +873,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
|| myProfile.getEditorAttributesKey(key, scope, project) != null;
|
||||
if (doUpdate) {
|
||||
myProfile.setErrorLevel(key, level, null, project);
|
||||
myProfile.setEditorAttributesKey(node.getKey().toString(), null, null, project);
|
||||
myProfile.setEditorAttributesKey(node.getKey().getShortName(), null, null, project);
|
||||
updateHighlightingChooser(nodes, project, highlightingChooser);
|
||||
toUpdate.add(node);
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
private boolean isThoughOneNodeEnabled(Collection<? extends InspectionConfigTreeNode.Tool> nodes) {
|
||||
final Project project = getProject();
|
||||
for (final InspectionConfigTreeNode.Tool node : nodes) {
|
||||
final String toolId = node.getKey().toString();
|
||||
final String toolId = node.getKey().getShortName();
|
||||
if (myProfile.getTools(toolId, project).isEnabled()) {
|
||||
return true;
|
||||
}
|
||||
@@ -1310,7 +1310,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
final List<ScopeToolState> tools = profile.getNonDefaultTools(desc.getKey().toString(), project);
|
||||
final List<ScopeToolState> tools = profile.getNonDefaultTools(desc.getKey().getShortName(), project);
|
||||
if (tools.size() != descriptors.size()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.profile.codeInspection.ui.inspectionsTree;
|
||||
|
||||
import com.intellij.analysis.AnalysisBundle;
|
||||
@@ -252,7 +252,7 @@ public final class InspectionsConfigTreeTable extends TreeTable {
|
||||
else {
|
||||
final MultiColoredHighlightSeverityIconSink sink = new MultiColoredHighlightSeverityIconSink();
|
||||
for (final HighlightDisplayKey selectedInspectionsNode : inspectionsKeys) {
|
||||
final String toolId = selectedInspectionsNode.toString();
|
||||
final String toolId = selectedInspectionsNode.getShortName();
|
||||
if (mySettings.getInspectionProfile().getTools(toolId, mySettings.getProject()).isEnabled()) {
|
||||
sink.put(mySettings.getInspectionProfile().getToolDefaultState(toolId, mySettings.getProject()),
|
||||
mySettings.getInspectionProfile().getNonDefaultTools(toolId, mySettings.getProject()));
|
||||
@@ -271,7 +271,7 @@ public final class InspectionsConfigTreeTable extends TreeTable {
|
||||
private Boolean isEnabled(@NotNull List<HighlightDisplayKey> selectedInspectionsNodes) {
|
||||
return selectedInspectionsNodes
|
||||
.stream()
|
||||
.map(key -> mySettings.getInspectionProfile().getTools(key.toString(), mySettings.getProject()))
|
||||
.map(key -> mySettings.getInspectionProfile().getTools(key.getShortName(), mySettings.getProject()))
|
||||
.flatMap(tools -> tools.isEnabled() ? tools.getTools().stream().map(ScopeToolState::isEnabled) : Stream.of(false))
|
||||
.distinct()
|
||||
.collect(MoreCollectors.onlyOne()).orElse(null);
|
||||
@@ -292,7 +292,7 @@ public final class InspectionsConfigTreeTable extends TreeTable {
|
||||
final InspectionProfileImpl profile = mySettings.getInspectionProfile();
|
||||
|
||||
for (final InspectionConfigTreeNode.Tool aNode : InspectionsAggregationUtil.getInspectionsNodes((InspectionConfigTreeNode)node)) {
|
||||
InspectionProfileImpl.setToolEnabled(doEnable, profile, aNode.getKey().toString(), mySettings.getProject());
|
||||
InspectionProfileImpl.setToolEnabled(doEnable, profile, aNode.getKey().getShortName(), mySettings.getProject());
|
||||
mySettings.onChanged(aNode);
|
||||
}
|
||||
updateRightPanel();
|
||||
@@ -327,7 +327,7 @@ public final class InspectionsConfigTreeTable extends TreeTable {
|
||||
final InspectionProfileImpl profile = mySettings.getInspectionProfile();
|
||||
|
||||
for (HighlightDisplayKey tool : tools) {
|
||||
InspectionProfileImpl.setToolEnabled(newState, profile, tool.toString(), mySettings.getProject());
|
||||
InspectionProfileImpl.setToolEnabled(newState, profile, tool.getShortName(), mySettings.getProject());
|
||||
}
|
||||
|
||||
for (InspectionConfigTreeNode node : nodes) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.profile.codeInspection.ui.table;
|
||||
|
||||
import com.intellij.application.options.colors.ColorAndFontOptions;
|
||||
@@ -182,7 +182,7 @@ public final class ScopesAndSeveritiesTable extends JBTable {
|
||||
for(final InspectionConfigTreeNode.Tool node : nodes) {
|
||||
final HighlightDisplayKey key = node.getKey();
|
||||
myKeys.add(key);
|
||||
myKeyNames.add(key.toString());
|
||||
myKeyNames.add(key.getShortName());
|
||||
}
|
||||
|
||||
myInspectionProfile = inspectionProfile;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.highlighting
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey
|
||||
@@ -53,7 +53,7 @@ class KotlinUnusedHighlightingVisitor(private val ktFile: KtFile) {
|
||||
deadCodeInfoType = if (deadCodeKey == null) null else
|
||||
HighlightInfoType.HighlightInfoTypeImpl(
|
||||
profile.getErrorLevel(deadCodeKey, ktFile).severity,
|
||||
((profile.getEditorAttributes(deadCodeKey.toString(), ktFile)) ?: HighlightInfoType.UNUSED_SYMBOL.getAttributesKey())
|
||||
((profile.getEditorAttributes(deadCodeKey.shortName, ktFile)) ?: HighlightInfoType.UNUSED_SYMBOL.getAttributesKey())
|
||||
)
|
||||
enabled = deadCodeInspection != null
|
||||
&& deadCodeInfoType != null
|
||||
|
||||
@@ -141,7 +141,7 @@ public class SpellCheckingEditorCustomization extends SimpleEditorCustomization
|
||||
|
||||
@Override
|
||||
public boolean isToolEnabled(HighlightDisplayKey key, PsiElement element) {
|
||||
return (key != null && SPELL_CHECK_TOOLS.containsKey(key.toString()) ? myUseSpellCheck : super.isToolEnabled(key, element));
|
||||
return (key != null && SPELL_CHECK_TOOLS.containsKey(key.getShortName()) ? myUseSpellCheck : super.isToolEnabled(key, element));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user