plugin.xml action shortcut works on windows, but don't work on mac
已回答
Hello, face the problem when described in plugin.xml action shortcut, works on windows, but don't work on mac.
<actions>
<action id="gorepogen.intellij.plugin.GenerateAction"
class="gorepogen.intellij.plugin.GenerateAction"
text="Generate Repository">
<add-to-group group-id="CodeMenu" anchor="after" relative-to-action="Generate"/>
<keyboard-shortcut keymap="$default" first-keystroke="alt G"/>
</action>
</actions>
Code section dropdown also not work on mac, when i click on it, just blink happens, instead of dropdown showing.
请先登录再写评论。
I cannot reproduce your issue - your actions definition is correct and works fine on Mac:
After invoking assigned actions, it stops on the breakpoint correctly.
Example of how it happens on my mac:
Mac version: Catalina 10.15.3 (19D76)
IDEA version: IntelliJ IDEA 2019.3.3 (Ultimate Edition)
IDEA build: Build #IU-193.6494.35, built on February 11, 2020
Having exactly the same IDE build, and OS version - in full screen as well - everything behaves correctly and Code menu appears and stays as it should.
Maybe there is something wrong with your Action's implementation of update method?
Btw, it perfectly works on windows. To be honest, i have only actionPerformed method implemented:
class GenerateAction : AnAction() {
override fun actionPerformed(event: AnActionEvent) {
val entityName = event.getData(PlatformDataKeys.EDITOR)?.selectionModel?.selectedText
if (entityName == null) {
MessageUtil.showHighlightEntityErrorMessage(event.project!!)
}
try {
FileUtil.save(event.getData(PlatformDataKeys.EDITOR)!!.document)
MessageUtil.showSuccessMessage(
event.project!!,
GenerationService.instance.generateFor(entityName!!, event.project!!.basePath!!)
)
} catch (ex: NotFoundException) {
MessageUtil.showDownloadAndInstallDialog(event.project!!)
}
}
}
Anything in the logs?
Thank you sir for help. I found what was the problem.
Could you please describe your solution and where the problem come from? So fellow plugin developers will be noticed...
Sure, problem was really stupid, but.. it was because of localised resource bundles.
I have messages_en_US.properties, on Windows locale was US, but on my Mac it was GB. So, because of that it work not as expected.
I just remove locale, and leave bundle just as messages.properties. Now it works as expected. CodeMenu dropdown open correctly.