Skip to content
Permalink
Browse files

[FIXED JENKINS-8470] Added option to select the participating

plug-ins in portlet.
  • Loading branch information
uhafner committed Jun 16, 2011
1 parent 4752b6d commit e7f77ceb37f7f339aa43149219e61127c9bca537
@@ -42,29 +42,51 @@
* Creates a new instance of {@link OriginGraph}.
*/
public OriginGraph() {
super();
this(AnalysisDescriptor.isCheckStyleInstalled(), AnalysisDescriptor.isDryInstalled(),
AnalysisDescriptor.isFindBugsInstalled(), AnalysisDescriptor.isPmdInstalled(),
AnalysisDescriptor.isOpenTasksInstalled(), AnalysisDescriptor.isWarningsInstalled());
}

if (AnalysisDescriptor.isCheckStyleInstalled()) {
/**
* Creates a new instance of {@link OriginGraph}.
*
* @param isCheckStyleActivated
* determines whether to show the warnings from Checkstyle
* @param isDryActivated
* determines whether to show the warnings from DRY
* @param isFindBugsActivated
* determines whether to show the warnings from FindBugs
* @param isPmdActivated
* determines whether to show the warnings from PMD
* @param isOpenTasksActivated
* determines whether to show open tasks
* @param isWarningsActivated
* determines whether to show compiler warnings
*/
public OriginGraph(final boolean isCheckStyleActivated, final boolean isDryActivated,
final boolean isFindBugsActivated, final boolean isPmdActivated,
final boolean isOpenTasksActivated, final boolean isWarningsActivated) {
if (isCheckStyleActivated) {
originsKeys.add(hudson.plugins.checkstyle.parser.Warning.ORIGIN);
originLabels.add(Messages.Analysis_Checkstyle_Warning_Origin());
}
if (AnalysisDescriptor.isDryInstalled()) {
if (isDryActivated) {
originsKeys.add(hudson.plugins.dry.parser.DuplicateCode.ORIGIN);
originLabels.add(Messages.Analysis_Dry_Warning_Origin());
}
if (AnalysisDescriptor.isFindBugsInstalled()) {
if (isFindBugsActivated) {
originsKeys.add(hudson.plugins.findbugs.parser.Bug.ORIGIN);
originLabels.add(Messages.Analysis_FindBugs_Warning_Origin());
}
if (AnalysisDescriptor.isPmdInstalled()) {
if (isPmdActivated) {
originsKeys.add(hudson.plugins.pmd.parser.Bug.ORIGIN);
originLabels.add(Messages.Analysis_PMD_Warning_Origin());
}
if (AnalysisDescriptor.isOpenTasksInstalled()) {
if (isOpenTasksActivated) {
originsKeys.add(hudson.plugins.tasks.parser.Task.ORIGIN);
originLabels.add(Messages.Analysis_Tasks_Warning_Origin());
}
if (AnalysisDescriptor.isWarningsInstalled()) {
if (isWarningsActivated) {
originsKeys.add(hudson.plugins.warnings.parser.Warning.ORIGIN);
originLabels.add(Messages.Analysis_Warnings_Warning_Origin());
}
@@ -2,6 +2,7 @@

import hudson.Extension;
import hudson.model.Descriptor;
import hudson.plugins.analysis.collector.AnalysisDescriptor;
import hudson.plugins.analysis.collector.AnalysisProjectAction;
import hudson.plugins.analysis.collector.Messages;
import hudson.plugins.analysis.collector.OriginGraph;
@@ -18,6 +19,13 @@
* @author Ulli Hafner
*/
public class WarningsOriginGraphPortlet extends AbstractWarningsGraphPortlet {
private final boolean isCheckStyleDeactivated;
private final boolean isDryDeactivated;
private final boolean isFindBugsDeactivated;
private final boolean isPmdDeactivated;
private final boolean isOpenTasksDeactivated;
private final boolean isWarningsDeactivated;

/**
* Creates a new instance of {@link WarningsOriginGraphPortlet}.
*
@@ -29,10 +37,88 @@
* height of the graph
* @param dayCountString
* number of days to consider
* @param isCheckStyleActivated
* determines whether to show the warnings from Checkstyle
* @param isDryActivated
* determines whether to show the warnings from DRY
* @param isFindBugsActivated
* determines whether to show the warnings from FindBugs
* @param isPmdActivated
* determines whether to show the warnings from PMD
* @param isOpenTasksActivated
* determines whether to show open tasks
* @param isWarningsActivated
* determines whether to show compiler warnings
*/
@DataBoundConstructor
public WarningsOriginGraphPortlet(final String name, final String width, final String height, final String dayCountString) {
// CHECKSTYLE:OFF
@DataBoundConstructor @SuppressWarnings("PMD.ExcessiveParameterList")
public WarningsOriginGraphPortlet(final String name, final String width, final String height, final String dayCountString,
final boolean isCheckStyleActivated, final boolean isDryActivated,
final boolean isFindBugsActivated, final boolean isPmdActivated,
final boolean isOpenTasksActivated, final boolean isWarningsActivated) {
super(name, width, height, dayCountString);

isDryDeactivated = !isDryActivated;
isFindBugsDeactivated = !isFindBugsActivated;
isPmdDeactivated = !isPmdActivated;
isOpenTasksDeactivated = !isOpenTasksActivated;
isWarningsDeactivated = !isWarningsActivated;
isCheckStyleDeactivated = !isCheckStyleActivated;
}
// CHECKSTYLE:ON

/**
* Returns whether CheckStyle results should be collected.
*
* @return <code>true</code> if CheckStyle results should be collected, <code>false</code> otherwise
*/
public boolean isCheckStyleActivated() {
return !isCheckStyleDeactivated;
}

/**
* Returns whether DRY results should be collected.
*
* @return <code>true</code> if DRY results should be collected, <code>false</code> otherwise
*/
public boolean isDryActivated() {
return !isDryDeactivated;
}

/**
* Returns whether FindBugs results should be collected.
*
* @return <code>true</code> if FindBugs results should be collected, <code>false</code> otherwise
*/
public boolean isFindBugsActivated() {
return !isFindBugsDeactivated;
}

/**
* Returns whether PMD results should be collected.
*
* @return <code>true</code> if PMD results should be collected, <code>false</code> otherwise
*/
public boolean isPmdActivated() {
return !isPmdDeactivated;
}

/**
* Returns whether open tasks should be collected.
*
* @return <code>true</code> if open tasks should be collected, <code>false</code> otherwise
*/
public boolean isOpenTasksActivated() {
return !isOpenTasksDeactivated;
}

/**
* Returns whether compiler warnings results should be collected.
*
* @return <code>true</code> if compiler warnings results should be collected, <code>false</code> otherwise
*/
public boolean isWarningsActivated() {
return !isWarningsDeactivated;
}

/** {@inheritDoc} */
@@ -50,20 +136,78 @@ protected String getPluginName() {
/** {@inheritDoc} */
@Override
protected BuildResultGraph getGraphType() {
return new OriginGraph();
return new OriginGraph(isCheckStyleActivated(), isDryActivated(), isFindBugsActivated(), isPmdActivated(), isOpenTasksActivated(), isWarningsActivated());
}

/**
* Extension point registration.
*
* @author Ulli Hafner
*/
@Extension(optional = true)
public static class WarningsGraphDescriptor extends Descriptor<DashboardPortlet> {
@Override
public String getDisplayName() {
return Messages.Portlet_WarningsOriginGraph();
}

/**
* Returns whether the Checkstyle plug-in is installed.
*
* @return <code>true</code> if the Checkstyle plug-in is installed,
* <code>false</code> if not.
*/
public boolean isCheckStyleInstalled() {
return AnalysisDescriptor.isCheckStyleInstalled();
}

/**
* Returns whether the Dry plug-in is installed.
*
* @return <code>true</code> if the Dry plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isDryInstalled() {
return AnalysisDescriptor.isDryInstalled();
}

/**
* Returns whether the FindBugs plug-in is installed.
*
* @return <code>true</code> if the FindBugs plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isFindBugsInstalled() {
return AnalysisDescriptor.isFindBugsInstalled();
}

/**
* Returns whether the PMD plug-in is installed.
*
* @return <code>true</code> if the PMD plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isPmdInstalled() {
return AnalysisDescriptor.isPmdInstalled();
}

/**
* Returns whether the Open Tasks plug-in is installed.
*
* @return <code>true</code> if the Open Tasks plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isOpenTasksInstalled() {
return AnalysisDescriptor.isOpenTasksInstalled();
}

/**
* Returns whether the Warnings plug-in is installed.
*
* @return <code>true</code> if the Warnings plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isWarningsInstalled() {
return AnalysisDescriptor.isWarningsInstalled();
}
}
}

@@ -1,32 +1,32 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util">
<j:if test="${descriptor.isCheckStyleInstalled()}">
<f:entry title="%{Checkstyle warnings}">
<f:entry title="${%Checkstyle warnings}">
<f:checkbox name="isCheckStyleActivated" checked="${h.defaultToTrue(instance.isCheckStyleActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isDryInstalled()}">
<f:entry title="%{Duplicate code warnings}">
<f:entry title="${%Duplicate code warnings}">
<f:checkbox name="isDryActivated" checked="${h.defaultToTrue(instance.isDryActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isFindBugsInstalled()}">
<f:entry title="%{FindBugs warnings}">
<f:entry title="${%FindBugs warnings}">
<f:checkbox name="isFindBugsActivated" checked="${h.defaultToTrue(instance.isFindBugsActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isPmdInstalled()}">
<f:entry title="%{PMD warnings}">
<f:entry title="${%PMD warnings}">
<f:checkbox name="isPmdActivated" checked="${h.defaultToTrue(instance.isPmdActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isOpenTasksInstalled()}">
<f:entry title="%{Open tasks}">
<f:entry title="${%Open tasks}">
<f:checkbox name="isOpenTasksActivated" checked="${h.defaultToTrue(instance.isOpenTasksActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isWarningsInstalled()}">
<f:entry title="%{Compiler warnings}">
<f:entry title="${%Compiler warnings}">
<f:checkbox name="isWarningsActivated" checked="${h.defaultToTrue(instance.isWarningsActivated())}"/>
</f:entry>
</j:if>
@@ -0,0 +1,6 @@
Checkstyle\ warnings=Checkstyle Warnungen
Duplicate\ code\ warnings=Duplizierter Quelltext
FindBugs\ warnings=FindBugs Warnungen
PMD\ warnings=PMD Warnungen
Open\ tasks=Offene Punkte
Compiler\ warnings=Compiler Warnungen
@@ -0,0 +1,33 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<j:if test="${descriptor.isCheckStyleInstalled()}">
<f:entry title="${%Checkstyle warnings}">
<f:checkbox name="isCheckStyleActivated" checked="${h.defaultToTrue(instance.isCheckStyleActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isDryInstalled()}">
<f:entry title="${%Duplicate code warnings}">
<f:checkbox name="isDryActivated" checked="${h.defaultToTrue(instance.isDryActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isFindBugsInstalled()}">
<f:entry title="${%FindBugs warnings}">
<f:checkbox name="isFindBugsActivated" checked="${h.defaultToTrue(instance.isFindBugsActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isPmdInstalled()}">
<f:entry title="${%PMD warnings}">
<f:checkbox name="isPmdActivated" checked="${h.defaultToTrue(instance.isPmdActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isOpenTasksInstalled()}">
<f:entry title="${%Open tasks}">
<f:checkbox name="isOpenTasksActivated" checked="${h.defaultToTrue(instance.isOpenTasksActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isWarningsInstalled()}">
<f:entry title="${%Compiler warnings}">
<f:checkbox name="isWarningsActivated" checked="${h.defaultToTrue(instance.isWarningsActivated())}"/>
</f:entry>
</j:if>
</j:jelly>
@@ -0,0 +1,6 @@
Checkstyle\ warnings=Checkstyle Warnungen
Duplicate\ code\ warnings=Duplizierter Quelltext
FindBugs\ warnings=FindBugs Warnungen
PMD\ warnings=PMD Warnungen
Open\ tasks=Offene Punkte
Compiler\ warnings=Compiler Warnungen
@@ -0,0 +1,2 @@
Name=
Show\ images\ in\ table\ header=

0 comments on commit e7f77ce

Please sign in to comment.
You can’t perform that action at this time.