public class BertErnieProjectProperty
extends JobProperty<AbstractProject<?,?>>
{
@Override
public Collection<? extends Action> getJobActions(final AbstractProject<?, ?> job)
{
final List<Action> actions = new ArrayList<Action>();
if(Elsewhere.subversionLocation(job) != null)
{
actions.add(new BertErnieProjectAction(job));
actions.add(new ChangedFilesProjectAction(job));
} // if ...
return actions;
} // getJobActions
@Extension
public static final class DescriptorImpl
extends JobPropertyDescriptor
{
public boolean isApplicable(final Class<? extends Job> jobType)
{
return true;
} // isApplicable
public String getDisplayName()
{
return null;
} // getDisplayName
public BertErnieProjectProperty newInstance(final StaplerRequest req,
final JSONObject formData)
throws FormException
{
return new BertErnieProjectProperty();
} // newInstance
} // DescriptorImpl
} // class BertErnieProjectProperty
Project properties don't, in the main, have a UI. They're simply a vehicle for attaching actions to a project. Jenkins calls getJobActions, the project action adds as many things as it likes and they get dropped in the sidebar menu.
There's an apparent discrepency between the way project actions and build actions are dealt with. You'll recall build actions are added to the build, and they get persisted away. I believe project actions once worked like that too. Now, however, they're rather more transient. Jenkins asks the builder, publisher or property for the project actions for this project. Now, all the project actions I've written have no state of their own - they interrogate the project and the builds, so I can just create a new action like this. If they do have some state of their own, you're going to have to manage the serialising and deserialising yourself. Jenkins can help you, quite a lot, but it's a layer of fiddly faff you probably don't want.