boolean (final IComponent component, final String fieldName, final String fieldClassName, final PsiClass psiClass, final GuiEditor editor, final Module module) { final PsiField[] fields = psiClass.getFields(); PsiField field = null; for(int i = fields.length - 1; i >=0 ; i--){ if(fieldName.equals(fields[i].getName())){ field = fields[i]; break; } } if(field == null){ final QuickFix[] fixes = editor != null ? new QuickFix[]{ new CreateFieldFix(editor, psiClass, fieldClassName, fieldName) } : QuickFix.EMPTY_ARRAY; component.putClientProperty( CLIENT_PROP_BINDING_ERROR, new ErrorInfo( component, null, UIDesignerBundle.message("error.no.field.in.class", fieldName, psiClass.getQualifiedName()), HighlightDisplayLevel.ERROR, fixes ) ); return true; } else if(field.hasModifierProperty(PsiModifier.STATIC)){ component.putClientProperty( CLIENT_PROP_BINDING_ERROR, new ErrorInfo( component, null, UIDesignerBundle.message("error.cant.bind.to.static", fieldName), HighlightDisplayLevel.ERROR, QuickFix.EMPTY_ARRAY ) ); return true; } // Check that field has correct fieldType try { final String className = fieldClassName.replace('$', '.'); // workaround for PSI final PsiType componentType = JavaPsiFacade.getInstance(module.getProject()).getElementFactory().createTypeFromText( className, null ); final PsiType fieldType = field.getType(); if(!fieldType.isAssignableFrom(componentType)){ final QuickFix[] fixes = editor != null ? new QuickFix[]{ new ChangeFieldTypeFix(editor, field, componentType) } : QuickFix.EMPTY_ARRAY; component.putClientProperty( CLIENT_PROP_BINDING_ERROR, new ErrorInfo( component, null, UIDesignerBundle.message("error.bind.incompatible.types", fieldType.getPresentableText(), className), HighlightDisplayLevel.ERROR, fixes ) ); return true; } } catch (IncorrectOperationException ignored) { } if (component.isCustomCreate() && FormEditingUtil.findCreateComponentsMethod(psiClass) == null) { final QuickFix[] fixes = editor != null ? new QuickFix[]{ new GenerateCreateComponentsFix(editor, psiClass) } : QuickFix.EMPTY_ARRAY; component.putClientProperty( CLIENT_PROP_BINDING_ERROR, new ErrorInfo( component, "Custom Create", UIDesignerBundle.message("error.no.custom.create.method"), HighlightDisplayLevel.ERROR, fixes)); return true; } return false; }