-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic support for grouping results by severity (#3)
- Loading branch information
Showing
13 changed files
with
221 additions
and
136 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
10 changes: 10 additions & 0 deletions
10
src/main/java/org/infernus/idea/checkstyle/actions/GroupBySeverity.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,10 @@ | ||
package org.infernus.idea.checkstyle.actions; | ||
|
||
import org.infernus.idea.checkstyle.toolwindow.ResultGrouping; | ||
|
||
public class GroupBySeverity extends GroupingAction { | ||
|
||
public GroupBySeverity() { | ||
super(ResultGrouping.BY_SEVERITY); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/infernus/idea/checkstyle/toolwindow/FileGroupTreeInfo.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,17 @@ | ||
package org.infernus.idea.checkstyle.toolwindow; | ||
|
||
import com.intellij.icons.AllIcons; | ||
|
||
public class FileGroupTreeInfo extends GroupTreeInfo { | ||
|
||
/** | ||
* Construct a file node. | ||
* | ||
* @param fileName the name of the file. | ||
* @param problemCount the number of problems in the file. | ||
*/ | ||
public FileGroupTreeInfo(final String fileName, final int problemCount) { | ||
super(fileName, "file", AllIcons.FileTypes.Java, problemCount); | ||
} | ||
|
||
} |
47 changes: 0 additions & 47 deletions
47
src/main/java/org/infernus/idea/checkstyle/toolwindow/FileResultTreeInfo.java
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/main/java/org/infernus/idea/checkstyle/toolwindow/GroupTreeInfo.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,51 @@ | ||
package org.infernus.idea.checkstyle.toolwindow; | ||
|
||
import org.infernus.idea.checkstyle.CheckStyleBundle; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.swing.*; | ||
|
||
abstract class GroupTreeInfo extends ResultTreeNode { | ||
|
||
private final String name; | ||
private final String groupId; | ||
private final int totalProblems; | ||
private int visibleProblems; | ||
|
||
/** | ||
* Construct a group node. | ||
* | ||
* @param name the name of the group. | ||
* @param groupId the ID used as part of message lookup. | ||
* @param icon the icon of the group. | ||
* @param problemCount the number of problems in the group. | ||
*/ | ||
public GroupTreeInfo(@NotNull final String name, | ||
@NotNull final String groupId, | ||
@NotNull final Icon icon, | ||
final int problemCount) { | ||
super(CheckStyleBundle.message("plugin.results.scan-" + groupId + "-result", name, problemCount)); | ||
|
||
this.name = name; | ||
this.groupId = groupId; | ||
this.totalProblems = problemCount; | ||
this.visibleProblems = problemCount; | ||
|
||
updateDisplayText(); | ||
setIcon(icon); | ||
} | ||
|
||
private void updateDisplayText() { | ||
if (totalProblems == visibleProblems) { | ||
setText(CheckStyleBundle.message("plugin.results.scan-" + groupId + "-result", name, totalProblems)); | ||
} else { | ||
setText(CheckStyleBundle.message("plugin.results.scan-" + groupId + "-result.filtered", name, visibleProblems, totalProblems - visibleProblems)); | ||
} | ||
} | ||
|
||
void setVisibleProblems(final int visibleProblems) { | ||
this.visibleProblems = visibleProblems; | ||
|
||
updateDisplayText(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/infernus/idea/checkstyle/toolwindow/PackageGroupTreeInfo.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,17 @@ | ||
package org.infernus.idea.checkstyle.toolwindow; | ||
|
||
import com.intellij.icons.AllIcons; | ||
|
||
public class PackageGroupTreeInfo extends GroupTreeInfo { | ||
|
||
/** | ||
* Construct a package node. | ||
* | ||
* @param packageName the name of the package. | ||
* @param problemCount the number of problems in the file. | ||
*/ | ||
public PackageGroupTreeInfo(final String packageName, final int problemCount) { | ||
super(packageName, "package", AllIcons.Nodes.Package, problemCount); | ||
} | ||
|
||
} |
47 changes: 0 additions & 47 deletions
47
src/main/java/org/infernus/idea/checkstyle/toolwindow/PackageTreeInfo.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
public enum ResultGrouping { | ||
|
||
BY_FILE, | ||
BY_PACKAGE | ||
BY_PACKAGE, | ||
BY_SEVERITY | ||
|
||
} |
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
Oops, something went wrong.