Beispiel #1
0
 /** Finds the editor message bundle for the supplied class. */
 protected static String findMessageBundle(Class<?> clazz) {
   EditorMessageBundle annotation = clazz.getAnnotation(EditorMessageBundle.class);
   if (annotation != null) {
     return annotation.value();
   }
   Class<?> eclazz = clazz.getEnclosingClass();
   if (eclazz != null) {
     return getMessageBundle(eclazz);
   }
   String name = clazz.getName();
   int idx;
   while ((idx = name.lastIndexOf('.')) != -1) {
     name = name.substring(0, idx);
     Package pkg = Package.getPackage(name);
     if (pkg != null) {
       annotation = pkg.getAnnotation(EditorMessageBundle.class);
       if (annotation != null) {
         return annotation.value();
       }
     }
   }
   return EditorMessageBundle.DEFAULT;
 }