added a copy callback, separate from the create callback.

This is based on a discussion in http://www.nabble.com/How-do-I-make-a-BuildWrapper-be-on-by-default--td25285336.html

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21785 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-09-17 17:53:12 +00:00
1 parent 484c3057b6
commit 8f00ea7df8
2 files changed
+20 -1

No files matched your search

+1 -1
View File
@@ -2490,7 +2490,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
items.put(name,result);
for (ItemListener l : ItemListener.all())
l.onCreated(result);
l.onCopied(src,result);
return result;
}
@@ -42,6 +42,25 @@ public class ItemListener implements ExtensionPoint {
public void onCreated(Item item) {
}
/**
* Called after a new job is created by copying from an existing job.
*
* For backward compatibility, the default implementation of this method calls {@link #onCreated(Item)}.
* If you choose to handle this method, think about whether you want to call super.onCopied or not.
*
*
* @param src
* The source item that the new one was copied from. Never null.
* @param item
* The newly created item. Never null.
*
* @since 1.325
* Before this version, a copy triggered {@link #onCreated(Item)}.
*/
public void onCopied(Item src, Item item) {
onCreated(item);
}
/**
* Called after all the jobs are loaded from disk into {@link Hudson}
* object.