How to insert action directly after generate menu item?

Answered

I'm trying to make an action show up directly below "==() and hashCode" in the generate menu. I used this:

<actions>
<action id="action.GenerateCopyWithMethodAction" class="action.GenerateCopyWithMethodAction" text="copyWith">
<add-to-group group-id="GenerateGroup" anchor="after" relative-to-action="GenerateEquals"/>
</action>
</actions>

But it shows it at the bottom of the generate menu (in the second section, after "Copyright"). I also tried using another relative actions, like GenerateConstructor, GenerateGetterAndSetter, both of which are definitely available in my menu, and it still appears at the bottom. Also, no changes replacing the anchor with "before". What am I doing wrong? 

7 comments

You'll need to use group-id="JavaGenerateGroup1" instead of "GenerateGroup", see JavaActions.xml declaration in IJ Community.

0

@Yann Cebron Thanks! But now it appears fixed at the beginning of the second section (tried with GenerateSetter and GenerateEquals as relative item). Is it not possible to insert the item in the top section directly below the relative action? Or am I still doing something wrong? Here the current xml:

<actions>
<action id="action.GenerateCopyWithMethodAction" class="action.GenerateCopyWithMethodAction" text="copyWith">
<add-to-group group-id="JavaGenerateGroup1" anchor="after" relative-to-action="GenerateEquals"/>
</action>
</actions>

0

Maybe related - This is for Android Studio using the Dart language plugin (in Dart files obviously).

0

See Dart's plugin.xml. Your anchor is `Generate.EqualsAndHashcode.Dart`.

1

That works, thanks!

Last question: Is there a way to make the inspector recognize this anchor as valid? Other than suppressing it with

<!--suppress PluginXmlValidity -->
0

I guess you need to add Dart plugin jar to your IntelliJ Plugin SDK Classpath.

0

Noted. Thanks. For now I'll let it like this since it seems to work.

0

Please sign in to leave a comment.