1 10 11 package org.netbeans.modules.logger.errormanager; 12 import org.netbeans.modules.logger.listeners.ListenerTools; 13 import org.openide.ErrorManager; 14 15 16 30 public class UIErrorManager extends ErrorManager{ 31 32 private static UIErrorManagerWriter manager; 33 private static UIErrorManager realUIErrorManager; 34 boolean doLog=false; 35 private String id; 36 37 38 private UIErrorManager(boolean doLogBoolean, String name) { 39 super(); 40 doLog=doLogBoolean; 41 id=name; 42 } 43 44 45 48 public UIErrorManager(){ 49 doLog=false; 50 id="registeredLogger"; 51 manager=new UIErrorManagerWriter(); 52 } 53 54 55 61 public ErrorManager getInstance(String name){ 62 if(!id.equals("registeredLogger")){ 63 ListenerTools.logError(new Throwable ("MAJOR BUG:Error Manager not unique!")); 64 } 65 if(realUIErrorManager==null){ 66 realUIErrorManager=new UIErrorManager(true,"realUIErrorManager"); 67 } 68 if(name==null)return this; 69 return name.equals("org.netbeans.ui.log") ? realUIErrorManager : this; 70 } 71 72 77 public void notify(int severity, Throwable t){ 78 } 79 80 87 public boolean isLoggable(int severity) { 88 return doLog; 89 } 90 91 96 public void log(int severity, String s){ 97 if(doLog){ 98 String time=Long.toString(System.currentTimeMillis()); 99 manager.log(time+" "+s); 100 } 101 } 102 103 113 public Throwable annotate( 114 Throwable t, int severity, 115 String message, String localizedMessage, 116 Throwable stackTrace, java.util.Date date 117 ) { 118 return t; 119 } 120 121 126 public Annotation[] findAnnotations(Throwable t){ 127 return null; 128 } 129 130 136 public Throwable attachAnnotations(Throwable t, Annotation[] arr){ 137 return null; 138 } 139 140 } 141 | Popular Tags |