Search in sources :

Example 1 with ChangeFieldTypeFix

use of com.intellij.uiDesigner.quickFixes.ChangeFieldTypeFix in project intellij-community by JetBrains.

the class MorphAction method updateBoundFieldType.

private static void updateBoundFieldType(final GuiEditor editor, final RadComponent oldComponent, final ComponentItem targetItem) {
    PsiField oldBoundField = BindingProperty.findBoundField(editor.getRootContainer(), oldComponent.getBinding());
    if (oldBoundField != null) {
        final PsiElementFactory factory = JavaPsiFacade.getInstance(editor.getProject()).getElementFactory();
        try {
            PsiType componentType = factory.createTypeFromText(targetItem.getClassName().replace('$', '.'), null);
            new ChangeFieldTypeFix(editor, oldBoundField, componentType).run();
        } catch (IncorrectOperationException e) {
            LOG.error(e);
        }
    }
}
Also used : PsiField(com.intellij.psi.PsiField) PsiElementFactory(com.intellij.psi.PsiElementFactory) ChangeFieldTypeFix(com.intellij.uiDesigner.quickFixes.ChangeFieldTypeFix) IncorrectOperationException(com.intellij.util.IncorrectOperationException) PsiType(com.intellij.psi.PsiType)

Aggregations

PsiElementFactory (com.intellij.psi.PsiElementFactory)1 PsiField (com.intellij.psi.PsiField)1 PsiType (com.intellij.psi.PsiType)1 ChangeFieldTypeFix (com.intellij.uiDesigner.quickFixes.ChangeFieldTypeFix)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1