-1

I have written a Intellij plugin that defines a custom action. I want to execute this via button icon like below.

enter image description here

Any pointers on how to add this?

Saim Raza
  • 1,420
  • 13
  • 16
  • https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development is the best place for such questions. – CrazyCoder Aug 05 '19 at 21:32
  • Thanks! Sometime it helps to be not a purist though. I figured out that it can be achieved through . – Saim Raza Aug 06 '19 at 13:22

2 Answers2

1

You can add the action to the VcsNavBarToobarActions groups. You can do this by adding something like the below to your plugin.xml.

<actions>
        <group text="MyNavBarGroup">
            <add-to-group group-id="VcsNavBarToobarActions" anchor="last"/>
            <action class="com.myplugin.action.RandomAction" text="Random" icon="/icons/pdf-icon.png"/>
        </group>
</actions>

I added a random pdf icon because that's what I had on hand. enter image description here

See the discussion on
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004225719-New-actions-on-toolbar

gregory
  • 188
  • 2
  • 17
  • Thanks! Adding to ToolbarRunGroup was a better solution in my case. – Saim Raza Aug 06 '19 at 13:23
  • No worries, could I please ask you to confirm and upvote the answer if you're happy with it? Let me know if you have any other questions about plugin development in the future, I may be able to help out. – gregory Aug 06 '19 at 13:30
1

Following worked for me:

<action id="MyCustomAction.UniqueID"
        class="com.mycompany.MyCustomAction"
        text="Execute an action" icon="/MyIcons/icon-16x16.png">
    <add-to-group group-id="ToolbarRunGroup" anchor="last"/>
</action>

It looks as follows:

enter image description here

Saim Raza
  • 1,420
  • 13
  • 16