mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: fix NPE in search results after creating inspection (IDEA-245668)
GitOrigin-RevId: 017224b0df11e7122bcbfd9fc41a9a64098ca73d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
898800322f
commit
605f21e3f8
+8
-5
@@ -1,11 +1,11 @@
|
||||
// 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.
|
||||
|
||||
package com.intellij.structuralsearch.plugin.ui;
|
||||
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.structuralsearch.MatchOptions;
|
||||
import com.intellij.structuralsearch.SSRBundle;
|
||||
import com.intellij.structuralsearch.plugin.replace.ui.ReplaceConfiguration;
|
||||
@@ -42,7 +42,7 @@ class StructuralSearchUsageTarget implements ConfigurableUsageTarget, ItemPresen
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean open) {
|
||||
public Icon getIcon(boolean unused) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -99,15 +99,18 @@ class StructuralSearchUsageTarget implements ConfigurableUsageTarget, ItemPresen
|
||||
public String getLongDescriptiveName() {
|
||||
final MatchOptions matchOptions = myConfiguration.getMatchOptions();
|
||||
final String pattern = matchOptions.getSearchPattern();
|
||||
final String scope = matchOptions.getScope().getDisplayName();
|
||||
final SearchScope scope = matchOptions.getScope();
|
||||
// a search without scope is not possible, if null here the configuration was modified after the search, which should not happen
|
||||
assert scope != null;
|
||||
final String scopeString = scope.getDisplayName();
|
||||
final String result;
|
||||
if (myConfiguration instanceof ReplaceConfiguration) {
|
||||
final ReplaceConfiguration replaceConfiguration = (ReplaceConfiguration)myConfiguration;
|
||||
final String replacement = replaceConfiguration.getReplaceOptions().getReplacement();
|
||||
result = SSRBundle.message("replace.occurrences.of.0.with.1.in.2", pattern, replacement, scope);
|
||||
result = SSRBundle.message("replace.occurrences.of.0.with.1.in.2", pattern, replacement, scopeString);
|
||||
}
|
||||
else {
|
||||
result = SSRBundle.message("occurrences.of.0.in.1", pattern, scope);
|
||||
result = SSRBundle.message("occurrences.of.0.in.1", pattern, scopeString);
|
||||
}
|
||||
return StringUtil.shortenTextWithEllipsis(result, 150, 0, true);
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class UsageViewContext {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
StructuralSearchProfileActionProvider.createNewInspection(myConfiguration, mySearchContext.getProject());
|
||||
StructuralSearchProfileActionProvider.createNewInspection(myConfiguration.copy(), mySearchContext.getProject());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user