I am trying to get the current value of my object to use in my
doFill...Items method. In the sample below I do not know how to implement
in my Descriptor
SampleBuilder builder=NOT SURE HOW TO ACQUIRE THIS
public class SampleBuilder extends Builder {
private String color;
@DataBoundConstructor
public SampleBuilder (String color) {
this.color = color;
}
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl) super.getDescriptor();
}
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
PrintStream logger = listener.getLogger();
logger.println("done");
return true;
}
@Extension
public static class DescriptorImpl extends BuildStepDescriptor<Builder>
{
public DescriptorImpl() {
super(SampleBuilder .class);
load();
}
@Override
public String getDisplayName() {
return "Sample";
}
@Override
public boolean isApplicable(Class jobType) {
return true;
}
public ListBoxModel doFillColorItems() {
load();
// acquire instance of builder being configured
SampleBuilder builder=NOT SURE HOW TO ACQUIRE THIS
ListBoxModel r = new ListBoxModel();
for (String c : new String[]{"red","yellow","blue","green"}) {
r.add(new Option(c, c, c.equalsIgnoreCase(builder.color)));
return r;
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.