Is it possible to add a menu item to search "Find in files" dialog?

Answered

Hello,

 

I want to know is it possible to add a menu item to search "Find in files" dialog?

 

Thank you!

0
6 comments

Hi Alexandr,

Please try adding your action to FindInFiles.Results.ContextMenu group.

0

Hi Karol,

 

Thank you! I tried this, but no success. Maybe I'm doing something wrong?

<action id="ua.haltentech.plugin.webview.actions.SendAction"
class="ua.haltentech.plugin.webview.actions.SendAction"
text="Send"
description="Send">
<add-to-group group-id="FindInFiles.Results.ContextMenu" anchor="last"/>
</action>
0

Hi Alexandr,

I don't see any problems with this code. Maybe your AnAction.update() hides it? If not, I suggest debugging:
https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java#L623

Check if the group contains your action and it's not removed later (I briefly checked it and can't see any removal, so maybe the problem is with your code).

0

Hi Karol,

 

Thank you! I tried different cases, but no success. Right now I'm getting this error:

com.intellij.diagnostic.PluginException: ua.haltentech.plugin.webview.actions.SendToWebviewFromSearchAction (ua.haltentech.plugin.webview.actions.SendToWebviewFromSearchAction): group with id "FindInFiles.Results.ContextMenu" isn't registered; action will be added to the "Other" group (module=PluginDescriptor(name=Webview, id=ua.haltentech.plugin.Webview, descriptorPath=plugin.xml, path=~/Projects/haltentech/webview-java-intellij-plugin/build/idea-sandbox/plugins/webview, version=1.0-SNAPSHOT, package=null, isBundled=false))

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.reportActionError(ActionManagerImpl.java:351)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getParentGroup(ActionManagerImpl.java:964)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.processAddToGroupNode(ActionManagerImpl.java:913)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.processActionElement(ActionManagerImpl.java:660)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerPluginActions(ActionManagerImpl.java:485)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerActions(ActionManagerImpl.java:169)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.<init>(ActionManagerImpl.java:141)

at com.jetbrains.rdserver.ui.actionPopupMenu.BackendActionManager.<init>(BackendActionManager.kt:17)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)

at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)

at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:891)

at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:51)

at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:41)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:119)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:73)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:66)

at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:610)

at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:584)

at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)

at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)

at com.intellij.openapi.actionSystem.ActionManager.getInstance(ActionManager.java:29)

at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame.lambda$prepareToShow$1(WelcomeFrame.java:163)

at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)

at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)

at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)

at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)

at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)

at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

 

Can this group be closed, for internal use only?

 

 

 

0

Hi Alexandr,

It was introduced relatively recently and is available from 2022.3 (I checked 2022.3.3, but it should work in 2022.3 as well).

0

Thank you so much, Karol!

I checked. I tested it in 2022.1 sandbox. Right now downloading 2022.3 to test.

0

Please sign in to leave a comment.