@Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      final PsiElement psiElement = descriptor.getPsiElement();
      final XmlAttributeValue attrValue = PsiTreeUtil.getParentOfType(psiElement, XmlAttributeValue.class, false);
      assert attrValue != null;

      final JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef reference =
        (JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef)attrValue.getReference();
      assert reference != null;

      final PsiClass targetClass = reference.getAClass();
      if (!FileModificationService.getInstance().prepareFileForWrite(targetClass.getContainingFile())) {
        return;
      }
      final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
      PsiField field = factory.createField(reference.getCanonicalText(), PsiTypes.intType());
      final PsiModifierList modifierList = field.getModifierList();
      if (modifierList != null) {
        @PsiModifier.ModifierConstant
        String visibility = JavaCodeStyleSettings.getInstance(targetClass.getContainingFile()).VISIBILITY;
        if (VisibilityUtil.ESCALATE_VISIBILITY.equals(visibility)) visibility = PsiModifier.PRIVATE;
        VisibilityUtil.setVisibility(modifierList, visibility);
        if (!PsiModifier.PUBLIC.equals(visibility)) {
          modifierList.addAnnotation(JavaFxCommonNames.JAVAFX_FXML_ANNOTATION);
        }
      }

      field = CreateFieldFromUsageHelper.insertField(targetClass, field, psiElement);

      final PsiClassType fieldType = factory.createType(checkContext(reference.getXmlAttributeValue()));
      final ExpectedTypeInfo[] types = {new ExpectedTypeInfoImpl(fieldType, ExpectedTypeInfo.TYPE_OR_SUBTYPE, fieldType,
                                                                 TailTypes.noneType(),
                                                                 null, ExpectedTypeInfoImpl.NULL)};
      CreateFieldFromUsageFix.createFieldFromUsageTemplate(targetClass, project, types, field, false, psiElement);
    }
@Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor)