Need help with extending the Properties plugin functionality


I'm writing a plugin that extends the Properties functionality by adding a new context menu to the Structure view. When I right-click on a property in a Structure view, I invoke a custom action which needs to send the information about the property elsewhere. Unfortunately I cannot figure out how to obtain that information in my actionPerformed() method. How can I know which property is currently selected? And how do I get the value of this property? I was able to obtain a PsiFile from AnActionEvent but that's where I got stuck.

Thanks in advance for any help!



P.S. Also, I can't figure out how to add the properties plugin dependency to my Gradle build. How can I find its group ID and artifact ID?


Official comment

use PropertiesImplUtil.getPropertiesFile(PsiElement) to obtain a PropertiesFile from PsiFile and after that call PropertiesFile#findPropertyByKey(String key) method.

to get selected property from Structure view: LangDataKeys.PSI_ELEMENT_ARRAY.getData(actionDataContext) this should help you to get selected properties.

Did you try to specify it in "intellij.plugins" (as written in


Yep, figured it out, thanks again!



Thanks, Dmitry, this is exactly what I was looking for. One other problem is that I can't figure out how to add the Properties maven dependency to my POM or Gradle. What is the group ID and artifact ID for the properties.jar? As far as I can tell, it's a separate plugin and not part of the IDEA SDK, am I right?



Please sign in to leave a comment.