提交 f63fd9f3 编写于 作者: K Kohsuke Kawaguchi

added a mechanism to redirect help file

上级 e3ea6bda
......@@ -195,6 +195,13 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
}
}
/**
* Help file redirect, keyed by the field name to the path.
*
* @see #getHelpFile(String)
*/
private final Map<String,String> helpRedirect = new HashMap<String, String>();
/**
*
* @param clazz
......@@ -595,6 +602,9 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
* locale variations.
*/
public String getHelpFile(final String fieldName) {
String v = helpRedirect.get(fieldName);
if (v!=null) return v;
for(Class c=clazz; c!=null; c=c.getSuperclass()) {
String page = "/descriptor/" + getId() + "/help";
String suffix;
......@@ -619,6 +629,15 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
return null;
}
/**
* Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for
* the 'fieldNameToRedirectTo' in the 'owner' class.
*/
protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
helpRedirect.put(fieldName,
Jenkins.getInstance().getDescriptor(owner).getHelpFile(fieldNameToRedirectTo));
}
/**
* Checks if the given object is created from this {@link Descriptor}.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册