mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
only display config sections for those descriptors that need it.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2042 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7ad73d9127
commit
c21345b30a
3 files changed
+37
-6
No files matched your search
@@ -1,7 +1,10 @@
|
||||
package hudson.maven;
|
||||
|
||||
import hudson.model.Descriptor;
|
||||
import hudson.maven.reporters.MavenArtifactArchiver;
|
||||
import hudson.model.Descriptor;
|
||||
import org.apache.commons.jelly.JellyException;
|
||||
import org.kohsuke.stapler.MetaClass;
|
||||
import org.kohsuke.stapler.jelly.JellyClassTearOff;
|
||||
|
||||
/**
|
||||
* {@link Descriptor} for {@link MavenReporter}.
|
||||
@@ -32,4 +35,17 @@ public abstract class MavenReporterDescriptor extends Descriptor<MavenReporter>
|
||||
public MavenReporter newAutoInstance(MavenModule module) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this descriptor has <tt>config.jelly</tt>.
|
||||
*/
|
||||
public final boolean hasConfigScreen() {
|
||||
MetaClass c = MetaClass.get(getClass());
|
||||
try {
|
||||
JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class);
|
||||
return tearOff.findScript(getConfigPage())!=null;
|
||||
} catch(JellyException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import hudson.maven.reporters.MavenArtifactArchiver;
|
||||
import hudson.maven.reporters.MavenFingerprinter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -18,4 +19,16 @@ public final class MavenReporters {
|
||||
MavenArtifactArchiver.DescriptorImpl.DESCRIPTOR,
|
||||
MavenFingerprinter.DescriptorImpl.DESCRIPTOR
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets the subset of {@link #LIST} that has configuration screen.
|
||||
*/
|
||||
public static List<MavenReporterDescriptor> getConfigurableList() {
|
||||
List<MavenReporterDescriptor> r = new ArrayList<MavenReporterDescriptor>();
|
||||
for (MavenReporterDescriptor d : LIST) {
|
||||
if(d.hasConfigScreen())
|
||||
r.add(d);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user