/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package hudson.plugins.emailext;

import java.util.Collection;
import java.util.Collections;

import hudson.Extension;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.TransientProjectActionFactory;

/**
 *
 * @author acearl
 */
@Extension
public class EmailExtTemplateActionFactory extends TransientProjectActionFactory {

    @Override
    public Collection<? extends Action> createFor(AbstractProject target) {
        boolean hasEmailExt = false;
        for(Object p : target.getPublishersList()) {
            if(p instanceof ExtendedEmailPublisher) {
                hasEmailExt = true;
                break;
            }
        }        
        
        if(hasEmailExt) {
            return Collections.singletonList(new EmailExtTemplateAction(target));
        }
        return Collections.EMPTY_LIST;
    }        
}

@@ -688,24 +688,79 @@
 t = false;%0D%0A
+        if (target.getPublishersList() != null) %7B%0D%0A    
         for(
@@ -813,16 +813,20 @@
         
+    
 if(p ins
@@ -876,16 +876,20 @@
         
+ 
+   
 hasEmail
@@ -921,16 +921,20 @@
     
+  
+  
 break;%0D%0A
     
@@ -929,16 +929,35 @@
 break;%0D%0A
+                %7D%0D%0A
         

Add workaround to prevent NPE in Maven projects