Sure, thanks for taking a look at it.
Could the problem be due to the newInstance method? I deleted it by accident
and the dropdown menu stayed. Unfortunately the batch file execution didn't
work any more..
I also have other classes in this plugin that make changes to the job's
configuration page in their respective config.jelly files. I wonder if this
could cause trouble.

*config.jelly*
During the build someFile1.bat should be executed (with the argument
selected from the dropdown menu) and then someFile2.bat should be executed.
The user is not supposed to change anything except for the argument. That's
why I put the textbox inside an invisibleEntry.

    <f:invisibleEntry>
        <f:textbox field="batchfile" default="C:\somePath1\someFile1.bat"/>
    </f:invisibleEntry>
    <f:entry>
        C:\somePath1\someFile1.bat argument
    </f:entry>
    <f:entry field="argument">
        <f:select/>
    </f:entry>
    <f:entry>
        C:\somePath2\someFile2.bat
    </f:entry>


*MyBuilder.java*
public class MyBuilder extends Builder {
    
    private final String batchfile;

    @DataBoundConstructor
    public MyBuilder(String batchfile) {
        this.batchfile = batchfile;
    }

    public String getBatchfile() {
        return batchfile;
    }
    
    @Extension
    public static final class DescriptorImpl extends
BuildStepDescriptor<Builder> {
        
        public String getDisplayName() {
            return "MyBuilder";
        }
        
        public ListBoxModel doFillArgumentItems() throws IOException {
            ListBoxModel model = new ListBoxModel();
            model.add("argument 1");
            model.add("argument 2");
            return model;
        }
        
        public boolean isApplicable(Class<? extends AbstractProject>
jobType) {
            return CustomProject.class.isAssignableFrom(jobType);
        }

        @Override
        public Builder newInstance(StaplerRequest req, JSONObject data)
throws FormException {
            return new BatchFile(data.getString("batchfile"));
        }
    }
}





Nimelrian wrote
> Could you post your config.jelly file and the relevant parts of your
> Builder class?
> 
> -----Ursprüngliche Nachricht-----
> Von: 

> jenkinsci-dev@

>  [mailto:

> jenkinsci-dev@

> ] Im Auftrag von 

> jenkinsuser92@

> Gesendet: Freitag, 19. September 2014 11:56
> An: 

> jenkinsci-dev@

> Betreff: UI of own builder not persisted
> 
> I wrote my own Builder class (MyClass extends Builder and DescriptorImpl
> extends BuildStepDescriptor
> <Builder>
> ). In the corresponding config.jelly I have a dropdown menu where the user
> can select a string which is then provided as an argument to a batch file. 
> Whenever I choose my builder on the config page of a job everything is
> fine. But as soon as I come back to this page the dropwdown menu has
> disappeared and there is the usual "execute windows batch file" textarea
> instead.
> What could be the reason for this behaviour?





--
View this message in context: 
http://jenkins-ci.361315.n4.nabble.com/UI-of-own-builder-not-persisted-tp4720283p4720291.html
Sent from the Jenkins dev mailing list archive at Nabble.com.

-- 
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/d/optout.

Reply via email to