1 12 13 package org.eclipse.jdt.internal.apt.pluggable.core.dispatch; 14 15 import javax.annotation.processing.Messager; 16 import javax.lang.model.element.AnnotationMirror; 17 import javax.lang.model.element.AnnotationValue; 18 import javax.lang.model.element.Element; 19 import javax.tools.Diagnostic.Kind; 20 21 import org.eclipse.core.runtime.IStatus; 22 import org.eclipse.core.runtime.Status; 23 import org.eclipse.jdt.internal.apt.pluggable.core.Apt6Plugin; 24 import org.eclipse.jdt.internal.compiler.CompilationResult; 25 import org.eclipse.jdt.internal.compiler.apt.dispatch.AptProblem; 26 import org.eclipse.jdt.internal.compiler.apt.dispatch.BatchMessagerImpl; 27 28 32 public class IdeMessagerImpl implements Messager { 33 34 private final IdeAnnotationProcessorManager _manager; 35 private final IdeProcessingEnvImpl _env; 36 37 public IdeMessagerImpl(IdeAnnotationProcessorManager manager, 38 IdeProcessingEnvImpl env) { 39 _manager = manager; 40 _env = env; 41 if (null == _manager || null == _env) { 43 throw new NullPointerException (); 44 } 45 } 46 47 50 public void printMessage(Kind kind, CharSequence msg) { 51 printMessage(kind, msg, null, null, null); 52 } 53 54 57 public void printMessage(Kind kind, CharSequence msg, Element e) { 58 printMessage(kind, msg, e, null, null); 59 } 60 61 64 public void printMessage(Kind kind, CharSequence msg, Element e, 65 AnnotationMirror a) { 66 printMessage(kind, msg, e, a, null); 67 68 } 69 70 73 public void printMessage(Kind kind, CharSequence msg, Element e, AnnotationMirror a, 74 AnnotationValue v) { 75 AptProblem problem = BatchMessagerImpl.createProblem(kind, msg, e); 76 if (kind == Kind.NOTE) { 77 Apt6Plugin.log(new Status(IStatus.INFO, Apt6Plugin.PLUGIN_ID, Apt6Plugin.STATUS_EXCEPTION, problem.getMessage(), null)); 78 } 79 else if (null != problem._referenceContext) { 80 CompilationResult result = problem._referenceContext.compilationResult(); 81 result.record(problem, problem._referenceContext); 82 } 83 else { 84 Apt6Plugin.log(new Status(IStatus.INFO, Apt6Plugin.PLUGIN_ID, Apt6Plugin.STATUS_EXCEPTION, problem.getMessage(), null)); 87 } 88 } 89 90 } 91 | Popular Tags |