Search in sources :

Example 6 with IRootContainer

use of com.intellij.uiDesigner.lw.IRootContainer in project intellij-community by JetBrains.

the class CustomCreateProperty method setValueImpl.

protected void setValueImpl(final RadComponent component, final Boolean value) throws Exception {
    if (value.booleanValue() && component.getBinding() == null) {
        String initialBinding = BindingProperty.getDefaultBinding(component);
        String binding = Messages.showInputDialog(component.getProject(), UIDesignerBundle.message("custom.create.field.name.prompt"), UIDesignerBundle.message("custom.create.title"), Messages.getQuestionIcon(), initialBinding, new IdentifierValidator(component.getProject()));
        if (binding == null) {
            return;
        }
        try {
            new BindingProperty(component.getProject()).setValue(component, binding);
        } catch (Exception e1) {
            LOG.error(e1);
        }
    }
    component.setCustomCreate(value.booleanValue());
    if (value.booleanValue()) {
        final IRootContainer root = FormEditingUtil.getRoot(component);
        if (root.getClassToBind() != null && Utils.getCustomCreateComponentCount(root) == 1) {
            final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), root.getClassToBind());
            if (aClass != null && FormEditingUtil.findCreateComponentsMethod(aClass) == null) {
                generateCreateComponentsMethod(aClass);
            }
        }
    }
}
Also used : IRootContainer(com.intellij.uiDesigner.lw.IRootContainer) IncorrectOperationException(com.intellij.util.IncorrectOperationException)

Aggregations

IRootContainer (com.intellij.uiDesigner.lw.IRootContainer)6 IComponent (com.intellij.uiDesigner.lw.IComponent)3 IncorrectOperationException (com.intellij.util.IncorrectOperationException)3 IContainer (com.intellij.uiDesigner.lw.IContainer)2 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)2 ArrayList (java.util.ArrayList)2 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)1 FormInspectionTool (com.intellij.uiDesigner.inspections.FormInspectionTool)1 IButtonGroup (com.intellij.uiDesigner.lw.IButtonGroup)1 QuickFix (com.intellij.uiDesigner.quickFixes.QuickFix)1 RadErrorComponent (com.intellij.uiDesigner.radComponents.RadErrorComponent)1 RadHSpacer (com.intellij.uiDesigner.radComponents.RadHSpacer)1 RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)1 RadVSpacer (com.intellij.uiDesigner.radComponents.RadVSpacer)1 HashSet (com.intellij.util.containers.HashSet)1 Nullable (org.jetbrains.annotations.Nullable)1