mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-158622 Search Everywhere for RD: add an extension for redirect old SE to the new one
GitOrigin-RevId: df553c10cf7a2017ddbf036a871d898816e7016e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4689842cfb
commit
a9cdaae205
@@ -14,6 +14,7 @@ import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButton;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionConfigurationCustomizer;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.keymap.MacKeymapUtil;
|
||||
import com.intellij.openapi.keymap.impl.ModifierKeyDoubleClickHandler;
|
||||
@@ -31,8 +32,8 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -41,6 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class SearchEverywhereAction extends SearchEverywhereBaseAction
|
||||
implements CustomComponentAction, RightAlignedToolbarAction, DumbAware, DataProvider {
|
||||
private static final Logger LOG = Logger.getInstance(SearchEverywhereAction.class);
|
||||
|
||||
public static final Key<ConcurrentHashMap<ClientId, JBPopup>> SEARCH_EVERYWHERE_POPUP = new Key<>("SearchEverywherePopup");
|
||||
|
||||
@@ -115,7 +117,25 @@ public class SearchEverywhereAction extends SearchEverywhereBaseAction
|
||||
}
|
||||
}
|
||||
|
||||
ReadAction.run(() -> showInSearchEverywherePopup(SearchEverywhereManagerImpl.ALL_CONTRIBUTORS_GROUP_ID, newEvent, true, true));
|
||||
if (!tryToOpenExternalEntryPoint(e)) {
|
||||
ReadAction.run(() -> showInSearchEverywherePopup(SearchEverywhereManagerImpl.ALL_CONTRIBUTORS_GROUP_ID, newEvent, true, true));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean tryToOpenExternalEntryPoint(@NotNull AnActionEvent e) {
|
||||
try {
|
||||
for (SearchEverywhereEntryPoint entryPoint: SearchEverywhereEntryPoint.EP_NAME.getExtensionList()) {
|
||||
if (entryPoint.isAvailable(e)) {
|
||||
entryPoint.initiateSearchPopup(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t) {
|
||||
LOG.warn(t);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.actions
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
interface SearchEverywhereEntryPoint {
|
||||
fun isAvailable(e: AnActionEvent): Boolean
|
||||
fun initiateSearchPopup(e: AnActionEvent): Boolean
|
||||
|
||||
companion object {
|
||||
@ApiStatus.Internal
|
||||
@JvmField
|
||||
val EP_NAME: ExtensionPointName<SearchEverywhereEntryPoint> = ExtensionPointName("com.intellij.searchEverywhere.entryPoint")
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,7 @@
|
||||
<extensionPoint name="searchEverywhereRemoteConverter" interface="com.intellij.ide.actions.searcheverywhere.remote.RemoteSearchEverywhereConverterSupplier" dynamic="true"/>
|
||||
<extensionPoint name="searchEverywhereReorderingService" interface="com.intellij.ide.actions.searcheverywhere.SearchEverywhereReorderingService" dynamic="true"/>
|
||||
<extensionPoint name="searchEverywherePreviewPrimaryUsageFinder" interface="com.intellij.ide.actions.searcheverywhere.SearchEverywherePreviewPrimaryUsageFinder" dynamic="true" />
|
||||
<extensionPoint name="searchEverywhere.entryPoint" interface="com.intellij.ide.actions.SearchEverywhereEntryPoint" dynamic="true" />
|
||||
|
||||
<extensionPoint name="runAnything.executionProvider" interface="com.intellij.ide.actions.runAnything.activity.RunAnythingProvider" dynamic="true"/>
|
||||
<extensionPoint name="runAnything.commandHandler" interface="com.intellij.ide.actions.runAnything.handlers.RunAnythingCommandHandler" dynamic="true"/>
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<searchEverywhere.entryPoint implementation="com.intellij.platform.searchEverywhere.frontend.SeEntryPoint"/>
|
||||
<searchEverywhere.tabFactory implementation="com.intellij.platform.searchEverywhere.frontend.tabs.all.SeAllTabFactory"/>
|
||||
<searchEverywhere.tabFactory implementation="com.intellij.platform.searchEverywhere.frontend.tabs.classes.SeClassesTabFactory"/>
|
||||
<searchEverywhere.tabFactory implementation="com.intellij.platform.searchEverywhere.frontend.tabs.files.SeFilesTabFactory"/>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.searchEverywhere.frontend
|
||||
|
||||
import com.intellij.ide.actions.SearchEverywhereEntryPoint
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class SeEntryPoint : SearchEverywhereEntryPoint {
|
||||
override fun isAvailable(e: AnActionEvent): Boolean {
|
||||
return SeFrontendService.isEnabled
|
||||
}
|
||||
|
||||
override fun initiateSearchPopup(e: AnActionEvent): Boolean {
|
||||
val project = e.project ?: return false
|
||||
SeFrontendService.getInstance(project).showPopup(null, e)
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user