String (final PsiFile psiFile, String fileText, String nameWithoutExtension) { if(psiFile instanceof PsiJavaFile javaFile){ String packageName = javaFile.getPackageName(); if (packageName.length() > 0){ fileText = StringUtil.replace(fileText, packageName, "${PACKAGE_NAME}"); } PsiClass[] classes = javaFile.getClasses(); PsiClass psiClass = null; for (PsiClass aClass : classes) { if (nameWithoutExtension.equals(aClass.getName())) { psiClass = aClass; break; } } if(psiClass != null){ //todo[myakovlev] ? PsiIdentifier nameIdentifier = psiClass.getNameIdentifier(); return StringUtil.replace(fileText, nameWithoutExtension,"${NAME}"); } } return null; }