How to take action after user accepts adding new Import via action?

I'd like to develop a Plugin that executes an action after the user accepts a new Import (like displayed in images below):


More context: After the user adds a new import, I want to execute an action that ensures that dependency exists in the BUCK file for that module, and if it doesn't then adds it.

So my question is: do IntelliJ Plugins have any sort of hook that I can build on top of to execute an action after a user has accepted a recommended import? Where might I start here?

1 comment

Hi,

there is no hook for that but I assume that normal inspection will work even better. Suppose one just write an import manually or more probably just paste some code from stackoverflow already with imports, you still want to ensure that everything is configured correctly. So I suggest to implement local inspection which would highlight imports which are missing and would provide a fix to add those missing dependencies. See com.intellij.codeInspection.LocalInspectionTool for details.

Anna

0

Please sign in to leave a comment.