1 19 20 package org.netbeans.modules.java.freeform.jdkselection; 21 22 import java.io.File ; 23 import org.apache.tools.ant.module.spi.AntEvent; 24 import org.apache.tools.ant.module.spi.AntLogger; 25 import org.apache.tools.ant.module.spi.AntSession; 26 27 31 public class Logger extends AntLogger { 32 33 34 public Logger() {} 35 36 @Override 37 public void messageLogged(AntEvent event) { 38 if (!event.isConsumed()) { 40 String msg = event.getMessage(); 41 if (isOurs(msg)) { 42 event.consume(); 44 event.getSession().deliverMessageLogged(event, msg, AntEvent.LOG_VERBOSE); 45 return; 46 } 47 } 48 } 49 50 private static boolean isOurs(String msg) { 51 String prefix = "Trying to override old definition of task "; if (msg.startsWith(prefix)) { 53 String task = msg.substring(prefix.length()); 54 if (task.equals("javac") || task.equals("java") || task.equals("junit") || task.equals("javadoc") || task.equals("nbjpdastart") || task.equals("http://java.netbeans.org/freeform/jdk.xml:property")) { return true; 61 } 62 } 63 return false; 64 } 65 66 private static final String [] TASKS = { 67 "macrodef", "presetdef", "propertyfile", }; 71 72 @Override 73 public String [] interestedInTasks(AntSession session) { 74 return TASKS; 75 } 76 77 @Override 78 public String [] interestedInTargets(AntSession session) { 79 return AntLogger.ALL_TARGETS; 80 } 81 82 @Override 83 public boolean interestedInSession(AntSession session) { 84 return true; 85 } 86 87 @Override 88 public boolean interestedInAllScripts(AntSession session) { 89 return true; 92 } 93 94 @Override 95 public int[] interestedInLogLevels(AntSession session) { 96 return new int[] { 97 AntEvent.LOG_INFO, 98 AntEvent.LOG_WARN, 99 }; 100 } 101 102 } 103 | Popular Tags |