FWDekker / intellij-randomness

IntelliJ plugin for inserting random numbers, UUIDs, names, IP addresses, and much more
https://plugins.jetbrains.com/plugin/9836-randomness
MIT License
45 stars 7 forks source link

Enhance popup #482

Open FWDekker opened 1 year ago

FWDekker commented 1 year ago

The current popup would benefit from more customisation and features, including:

This can be achieved by implementing my own PopupStep.


Old description: It annoys me to no end that the "0" shortcut in the settings by default refers to the settings, but that's only because it's coincidentally the 10th scheme. I think configuring it to always link to opening the main settings would be a more logical choice.

FWDekker commented 1 year ago

I feel like I've investigated this before, but this is not actually possible, because the numbering is determined by a setting of JBPopupFactory, and is not something I have control over (beyond enabling/disabling it). Therefore, this issue cannot (currently) be solved.

FWDekker commented 12 months ago

Actually, I think I can solve this. Simply put the settings entry at the very top, similar to IntelliJ's own Run configurations popup, where 0 is always the first entry, and pressing 0 while focusing on an entry will open the settings focused on that entry.

FWDekker commented 12 months ago

JBPopupFactory (and the deeply nested class that makes the popup) only supports displaying the entries in the order 1, 2, ..., 9, 0, A, B, ..., Z. As a result, the settings action will be at 1, and the first template action at 2. In the settings dialog, the templates will thus start at 2, which I dislike.

Therefore, the solution will be to implement a custom PopupStep class which has the desired behaviour. With this additional freedom, I can also add other nice features. I will add this to the issue's description. I will postpone the code rewrite to v3.1.0.