gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritItemListener.java
/**
     * Called by Jenkins when an item is about to be deleted. If this item is a project
     * (AbstractProject or any of its subclasses), then we check if it has a GerritTrigger
     * among its triggers. If so, call the trigger's cancelTimer() method.
     *
     * This class is unfortunately needed because Jenkins doesn't call Trigger.stop() when
     * a project is deleted, only when a project is reconfigured. Thus we need this class
     * to cancel the timer when a project is deleted.
     *
     * @param item the item that will be deleted, it is interesting if it is
     * a subclass of an AbstractProject
     */
Called by Jenkins when an item is about to be deleted. If this item is a project
(AbstractProject or any of its subclasses), then we check if it has a GerritTrigger
among its triggers. If so, call the trigger's cancelTimer() method.

This class is unfortunately needed because Jenkins doesn't call Trigger.stop() when
a project is deleted, only when a project is reconfigured. Thus we need this class
to cancel the timer when a project is deleted.

@param item the item that will be deleted, it is interesting if it is
a subclass of an AbstractProject
Called by Jenkins when an item is about to be deleted . If this item is a project ( AbstractProject or any of its subclasses ) then we check if it has a GerritTrigger among its triggers . If so call the trigger ' s cancelTimer () method . This class is unfortunately needed because Jenkins doesn ' t call Trigger . stop () when a project is deleted only when a project is reconfigured . Thus we need this class to cancel the timer when a project is deleted . @param item the item that will be deleted it is interesting if it is a subclass of an AbstractProject
@Override
    public void onDeleted(Item item) {
        if (item instanceof AbstractProject<?, ?>) {
            AbstractProject<?, ?> project = (AbstractProject<?, ?>)item;
            GerritTrigger gerritTrigger = project.getTrigger(GerritTrigger.class);
            if (gerritTrigger != null) {
                gerritTrigger.cancelTimer();
            }
        }
    }
@ Override public void onDeleted ( Item item ) { if ( item instanceof AbstractProject < ? , ? > ) { AbstractProject < ? , ? > project = ( AbstractProject < ? , ? > ) item ; GerritTrigger gerritTrigger = project . getTrigger ( GerritTrigger . class ) ; if ( gerritTrigger != null ) { gerritTrigger . cancelTimer ( ) ; } } }
Called by Jenkins when an item is about to be deleted.
Called by Jenkins when an item is about to be deleted .