1 19 package org.netbeans.modules.xml.tax.util; 20 21 import org.openide.ErrorManager; 22 import org.openide.util.Lookup; 23 import org.openide.util.NbBundle; 24 25 38 public abstract class AbstractUtil { 39 40 private ErrorManager packageErrorManager; 41 42 private static final int DEBUG_SEVERITY = ErrorManager.INFORMATIONAL; 43 44 45 49 50 55 public final String getString (String key) { 56 if (key == null) throw new NullPointerException (); 57 return NbBundle.getMessage (this.getClass(), key); 58 } 59 60 66 public final String getString (String key, Object param) { 67 if (key == null) throw new NullPointerException (); 68 return NbBundle.getMessage (this.getClass(), key, param); 69 } 70 71 78 public final String getString (String key, Object param1, Object param2) { 79 if (key == null) throw new NullPointerException (); 80 return NbBundle.getMessage (this.getClass(), key, param1, param2); 81 } 82 83 88 public final char getChar (String key) { 89 if (key == null) throw new NullPointerException (); 90 return NbBundle.getMessage (this.getClass(), key).charAt (0); 91 } 92 93 94 98 102 public final boolean isLoggable () { 103 return getErrorManager().isLoggable (DEBUG_SEVERITY); 104 } 105 106 111 public final void debug (String message) { 112 if (message == null) return; 113 getErrorManager().log (DEBUG_SEVERITY, message); 114 } 115 116 121 public final void debug (Throwable ex) { 122 if (ex == null) return; 123 getErrorManager().notify (DEBUG_SEVERITY, ex); 124 } 125 126 132 public final void debug (String message, Throwable ex) { 133 if (ex == null) return; 134 if (message != null) { 135 ex = getErrorManager().annotate(ex, DEBUG_SEVERITY, message, null, null, null); 136 } 137 debug (ex); 138 } 139 140 145 public final synchronized ErrorManager getErrorManager () { 146 if ( packageErrorManager == null ) { 147 String pack = "org.netbeans.modules.xml.tax.util"; packageErrorManager = ErrorManager.getDefault().getInstance(pack); 149 } 150 return packageErrorManager; 151 } 152 153 } 154 | Popular Tags |