private static void generateGetMessageFromBundle(PsiClass aClass, PsiMethod anchor, PsiElementFactory elementFactory, boolean condition) {
    String dynamicBundleClassName = DynamicBundle.class.getName();

    String methodName = AsmCodeGenerator.GET_MESSAGE_FROM_BUNDLE;
    for (PsiMethod oldMethod : aClass.findMethodsByName(methodName, false)) {
      oldMethod.delete();
    }

    String fieldName = AsmCodeGenerator.CACHED_GET_BUNDLE_METHOD;
    PsiField oldField = aClass.findFieldByName(fieldName, false);
    if (oldField != null) {
      oldField.delete();
    }

    if (!condition) {
      return;
    }

    PsiField cachedMethodField =
      elementFactory.createFieldFromText(
        "private static java.lang.reflect.Method " + fieldName + " = null;",
        null);

    String methodText =
      "private String " + methodName + "(String path, String key) {\n" +
      " ResourceBundle bundle;\n" +
      "try {\n" +
      "    Class<?> thisClass = this.getClass();\n" +
      "    if (" + fieldName + " == null) {\n" +
      "        Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass(\"" + dynamicBundleClassName + "\");\n" +
      "        " + fieldName + " = dynamicBundleClass.getMethod(\"getBundle\", String.class, Class.class);\n" +
      "    }\n" +
      "    bundle = (ResourceBundle)" + fieldName + ".invoke(null, path, thisClass);\n" +
      "} catch (Exception e) {\n" +
      "    bundle = ResourceBundle.getBundle(path);\n" +
      "}\n" +
      "return bundle.getString(key);\n" +
      "}";

    PsiMethod method = elementFactory.createMethodFromText(methodText, aClass);

    aClass.addAfter(method, anchor);
    aClass.addAfter(cachedMethodField, anchor);
  }
private static void generateGetMessageFromBundle(PsiClass aClass, PsiMethod anchor, PsiElementFactory elementFactory, boolean condition)