mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-20 07:22:32 +00:00
added a mechanism to refer to controls in the ancestor, not just the siblings.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34581 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
ad42894528
commit
e4e947081e
3 files changed
+65
-14
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package hudson;
|
||||
|
||||
import org.kohsuke.stapler.QueryParameter;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
/**
|
||||
* Used in conjunction with {@link QueryParameter} to refer to
|
||||
* nearby parameters that belong to different parents.
|
||||
*
|
||||
* <p>
|
||||
* Currently, "..", "../..", etc. are supported to indicate
|
||||
* parameters that belong to the ancestors.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 1.376
|
||||
*/
|
||||
@Documented
|
||||
@Target(PARAMETER)
|
||||
@Retention(RUNTIME)
|
||||
public @interface RelativePath {
|
||||
String value();
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package hudson.model;
|
||||
|
||||
import hudson.RelativePath;
|
||||
import hudson.XmlFile;
|
||||
import hudson.BulkChange;
|
||||
import hudson.Util;
|
||||
@@ -300,6 +301,10 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
|
||||
if (name==null || name.length()==0)
|
||||
continue; // unknown parameter name. we'll report the error when the form is submitted.
|
||||
|
||||
RelativePath rp = p.annotation(RelativePath.class);
|
||||
if (rp!=null)
|
||||
name = rp.value()+'/'+name;
|
||||
|
||||
if (query.length()==0) query.append("+qs(this)");
|
||||
|
||||
if (name.equals("value")) {
|
||||
@@ -346,6 +351,10 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
|
||||
if (name==null || name.length()==0)
|
||||
continue; // unknown parameter name. we'll report the error when the form is submitted.
|
||||
|
||||
RelativePath rp = p.annotation(RelativePath.class);
|
||||
if (rp!=null)
|
||||
name = rp.value()+'/'+name;
|
||||
|
||||
depends.add(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user