mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add generateBriefReport() API for JavaCoverageEngineExtension
This commit is contained in:
@@ -269,13 +269,13 @@ public abstract class CoverageEngine {
|
||||
/**
|
||||
* Content of brief report which will be shown by click on coverage icon
|
||||
*
|
||||
* @param editor
|
||||
* @param psiFile
|
||||
* @param lineNumber
|
||||
* @param startOffset
|
||||
* @param endOffset
|
||||
* @param lineData
|
||||
* @return
|
||||
* @param editor the editor in which the gutter is displayed.
|
||||
* @param psiFile the file shown in the editor.
|
||||
* @param lineNumber the line number which was clicked.
|
||||
* @param startOffset the start offset of that line in the PSI file.
|
||||
* @param endOffset the end offset of that line in the PSI file.
|
||||
* @param lineData the coverage data for the line.
|
||||
* @return the text to show.
|
||||
*/
|
||||
public String generateBriefReport(@NotNull Editor editor,
|
||||
@NotNull PsiFile psiFile,
|
||||
|
||||
@@ -389,6 +389,15 @@ public class JavaCoverageEngine extends CoverageEngine {
|
||||
}
|
||||
buf.append(lineData.getHits()).append("\n");
|
||||
|
||||
|
||||
for (JavaCoverageEngineExtension extension : Extensions.getExtensions(JavaCoverageEngineExtension.EP_NAME)) {
|
||||
String report = extension.generateBriefReport(editor, psiFile, lineNumber, startOffset, endOffset, lineData);
|
||||
if (report != null) {
|
||||
buf.append(report);
|
||||
return report;
|
||||
}
|
||||
}
|
||||
|
||||
final List<PsiExpression> expressions = new ArrayList<PsiExpression>();
|
||||
|
||||
final Project project = editor.getProject();
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.intellij.coverage;
|
||||
|
||||
import com.intellij.execution.configurations.RunConfigurationBase;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.rt.coverage.data.LineData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -13,8 +15,10 @@ import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 2/14/11
|
||||
* Allows to customize the Java coverage engine for other JVM-based languages.
|
||||
*
|
||||
* @author anna
|
||||
* @since 2/14/11
|
||||
*/
|
||||
public abstract class JavaCoverageEngineExtension {
|
||||
public static final ExtensionPointName<JavaCoverageEngineExtension> EP_NAME = ExtensionPointName.create("com.intellij.javaCoverageEngineExtension");
|
||||
@@ -25,6 +29,16 @@ public abstract class JavaCoverageEngineExtension {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects the output .class files generated from a specific source file.
|
||||
*
|
||||
* @param srcFile the source file.
|
||||
* @param output the output root for the module containing the source file.
|
||||
* @param testoutput the test output root for the module containing the source file.
|
||||
* @param suite the coverage suite for which the information is being requested.
|
||||
* @param classFiles the set to be filled with class files produced from this source file.
|
||||
* @return true if the extension has filled the file list, false if this extension doesn't handle this file type.
|
||||
*/
|
||||
public boolean collectOutputFiles(@NotNull final PsiFile srcFile,
|
||||
@Nullable final VirtualFile output,
|
||||
@Nullable final VirtualFile testoutput,
|
||||
@@ -32,4 +46,20 @@ public abstract class JavaCoverageEngineExtension {
|
||||
@NotNull final Set<File> classFiles){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text to show when clicking on the coverage gutter. The text usually contains the number of true and false branch hits
|
||||
* for conditional statements.
|
||||
*
|
||||
* @param editor the editor in which the gutter is displayed.
|
||||
* @param file the file shown in the editor.
|
||||
* @param lineNumber the line number which was clicked.
|
||||
* @param startOffset the start offset of that line in the PSI file.
|
||||
* @param endOffset the end offset of that line in the PSI file.
|
||||
* @param lineData the coverage data for the line.
|
||||
* @return the text to show, or null if this extension doesn't handle this file type or doesn't have any custom text to show.
|
||||
*/
|
||||
public String generateBriefReport(Editor editor, PsiFile file, int lineNumber, int startOffset, int endOffset, LineData lineData) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user