mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] prevent top hit action contributor from failing on missing action
GitOrigin-RevId: 69bfdee325f950215adffc5b7dc700e4aadcdb06
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fae049fed4
commit
f8c4479cde
@@ -2,6 +2,8 @@
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -13,13 +15,21 @@ import java.util.function.Consumer;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class ActionsTopHitProvider implements SearchTopHitProvider {
|
||||
private static final Logger LOG = Logger.getInstance(ActionsTopHitProvider.class);
|
||||
|
||||
@Override
|
||||
public void consumeTopHits(@NotNull String pattern, @NotNull Consumer<Object> collector, @Nullable Project project) {
|
||||
final ActionManager actionManager = ActionManager.getInstance();
|
||||
for (String[] strings : getActionsMatrix()) {
|
||||
if (StringUtil.isBetween(pattern, strings[0], strings[1])) {
|
||||
for (int i = 2; i < strings.length; i++) {
|
||||
collector.accept(actionManager.getAction(strings[i]));
|
||||
String actionId = strings[i];
|
||||
AnAction action = actionManager.getAction(actionId);
|
||||
if(action == null) {
|
||||
LOG.warn("Action " + actionId + " not found");
|
||||
} else {
|
||||
collector.accept(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user