Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[Fixed JENKINS-12307] Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed May 30, 2012
1 parent ef880b8 commit f9ca3bb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 1 addition & 7 deletions src/main/java/hudson/plugins/warnings/ConsoleParser.java
Expand Up @@ -3,7 +3,6 @@
import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.plugins.warnings.parser.ParserDescription;
import hudson.plugins.warnings.parser.ParserRegistry;
import hudson.util.ListBoxModel;

Expand Down Expand Up @@ -76,17 +75,12 @@ public static class DescriptorImpl extends Descriptor<ConsoleParser> {
* @return the model of the list box
*/
public ListBoxModel doFillParserNameItems() {
ListBoxModel items = new ListBoxModel();
for (ParserDescription parser : ParserRegistry.getAvailableParsers()) {
items.add(parser.getGroup());
}
return items;
return ParserRegistry.getParsersAsListModel();
}

@Override
public String getDisplayName() {
return StringUtils.EMPTY;
}
}

}
Expand Up @@ -5,7 +5,6 @@
import hudson.model.AbstractDescribableImpl;
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.plugins.warnings.parser.ParserDescription;
import hudson.plugins.warnings.parser.ParserRegistry;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
Expand Down Expand Up @@ -99,11 +98,7 @@ public static class DescriptorImpl extends Descriptor<ParserConfiguration> {
* @return the model of the list box
*/
public ListBoxModel doFillParserNameItems() {
ListBoxModel items = new ListBoxModel();
for (ParserDescription parser : ParserRegistry.getAvailableParsers()) {
items.add(parser.getGroup());
}
return items;
return ParserRegistry.getParsersAsListModel();
}

@Override
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/hudson/plugins/warnings/parser/ParserRegistry.java
Expand Up @@ -8,6 +8,7 @@
import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.warnings.WarningsDescriptor;
import hudson.plugins.warnings.GroovyParser;
import hudson.util.ListBoxModel;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -73,6 +74,19 @@ private static void addParsersWithDeprecatedApi(final Hudson instance, final Lis
}
}

/**
* Returns the available parsers as a list model.
*
* @return the model of the list box
*/
public static ListBoxModel getParsersAsListModel() {
ListBoxModel items = new ListBoxModel();
for (ParserDescription parser : getAvailableParsers()) {
items.add(parser.getGroup());
}
return items;
}

/**
* Returns all available parsers groups, sorted alphabetically.
*
Expand Down

0 comments on commit f9ca3bb

Please sign in to comment.