-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from martenbohlin/run-in-background
Run in background
- Loading branch information
Showing
3 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/intellij/plugins/bodhi/pmd/core/PMDProgressRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.intellij.plugins.bodhi.pmd.core; | ||
|
||
import com.intellij.openapi.progress.ProgressIndicator; | ||
import net.sourceforge.pmd.Report; | ||
import net.sourceforge.pmd.renderers.AbstractRenderer; | ||
import net.sourceforge.pmd.util.datasource.DataSource; | ||
|
||
import java.io.IOException; | ||
|
||
public class PMDProgressRenderer extends AbstractRenderer { | ||
private final ProgressIndicator progress; | ||
private final int totalFiles; | ||
private int processedFiles = 0; | ||
|
||
public PMDProgressRenderer(ProgressIndicator progress, int totalFiles) { | ||
super("Progress", "Reports progress to IntelliJ"); | ||
|
||
this.progress = progress; | ||
this.totalFiles = totalFiles; | ||
} | ||
|
||
@Override | ||
public String defaultFileExtension() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void start() throws IOException { | ||
} | ||
|
||
@Override | ||
public void startFileAnalysis(DataSource dataSource) { | ||
processedFiles++; | ||
progress.setFraction(processedFiles / (double) totalFiles); | ||
progress.setText2(dataSource.getNiceFileName(true, null)); | ||
} | ||
|
||
@Override | ||
public void renderFileReport(Report report) throws IOException { | ||
|
||
} | ||
|
||
@Override | ||
public void end() throws IOException { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters