I have a few questions regarding code coverage and plugin development in IntelliJ IDEA.

Answered

Requirement description: I need to develop a plug-in to obtain the .exec file generated by jacoco on the server deployed by our system, download it locally, and then in IDEA, run -> Show Coverage Data... -> Add, Import it and display the coverage data we executed in IDEA.
But I encountered a little problem, as follows:
1. Through Run -> Show Coverage Data... -> Add, will this operation save the newly added exec file in the directory? Or is it just a file reference?
If it is saved in a directory, in which directory is it saved? Can I copy my exec file to this directory and display it in the Choose Coverage Suite to Display window?
If it is a file reference, how should I display it in the Choose Coverage Suite to Display window?
2. Can this Add button be used for secondary development? Or add a button next to it, click it and enter the information to download our exec file locally, and then display it in the current window?

Thanks!

 

0
2 comments

Hi, xiaobai0314!
1. Coverage report import takes the file as a reference, so it does not store the file anywhere. You can use `com.intellij.coverage.CoverageDataManager#addExternalCoverageSuite` method to register your report, in this case, the file will appear in the dialog. For more details, please see `com.intellij.coverage.actions.CoverageSuiteChooserDialog` implementation

2. I suppose you can override `com.intellij.coverage.actions.CoverageSuiteChooserDialog` behaviour. Namely, in the `com.intellij.coverage.actions.CoverageSuiteChooserDialog#createNorthPanel` method there is a list of actions that are available in the toolbar. You can replace or add one. 
However, there is no extension point for dialog creation, so you could reuse this dialog in your own action the same way as `com.intellij.coverage.actions.SwitchCoverageSuiteAction` does

1

Hi, Maksim Zuev!

I have never written about the functions of IDEA plug-in development. Are there any existing examples that implement this function? I would like to refer to it.
Thanks!

0

Please sign in to leave a comment.