Java 类com.intellij.uiDesigner.lw.IRootContainer 实例源码

项目:consulo-ui-designer    文件:FormEditingUtil.java   
public static Set<String> collectUsedBundleNames(final IRootContainer rootContainer)
{
    final Set<String> bundleNames = new HashSet<String>();
    iterateStringDescriptors(rootContainer, new StringDescriptorVisitor<IComponent>()
    {
        public boolean visit(final IComponent component, final StringDescriptor descriptor)
        {
            if(descriptor.getBundleName() != null && !bundleNames.contains(descriptor.getBundleName()))
            {
                bundleNames.add(descriptor.getBundleName());
            }
            return true;
        }
    });
    return bundleNames;
}
项目:intellij-ce-playground    文件:CustomCreateProperty.java   
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);
      }
    }
  }
}
项目:intellij-ce-playground    文件:ListenerNavigateButton.java   
@Nullable
public static DefaultActionGroup prepareActionGroup(final RadComponent component) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String classToBind = root == null ? null : root.getClassToBind();
  if (classToBind != null) {
    final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), classToBind);
    if (aClass != null) {
      final PsiField boundField = aClass.findFieldByName(component.getBinding(), false);
      if (boundField != null) {
        return buildNavigateActionGroup(component, boundField);
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:NoButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  if (FormInspectionUtil.isComponentClass(module, component, JRadioButton.class)) {
    final IRootContainer root = FormEditingUtil.getRoot(component);
    if (root == null) return;
    if (root.getButtonGroupName(component) == null) {
      EditorQuickFixProvider quickFixProvider = null;
      IContainer parent = component.getParentContainer();
      for(int i=0; i<parent.getComponentCount(); i++) {
        IComponent child = parent.getComponent(i);
        if (child != component &&
            FormInspectionUtil.isComponentClass(module, child, JRadioButton.class)) {
          final GridConstraints c1 = component.getConstraints();
          final GridConstraints c2 = child.getConstraints();
          if (areCellsAdjacent(parent, c1, c2)) {
            final String groupName = root.getButtonGroupName(child);
            if (groupName == null) {
              quickFixProvider = new EditorQuickFixProvider() {
                 public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                   return new CreateGroupQuickFix(editor, component, c1.getColumn() == c2.getColumn());
                 }
               };
              break;
            }
            else {
              quickFixProvider = new EditorQuickFixProvider() {
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                  return new AddToGroupQuickFix(editor, component, groupName);
                }
              };
            }
          }
        }
      }
      collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.no.button.group.error"), quickFixProvider);
    }
  }
}
项目:intellij-ce-playground    文件:OneButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  if (root == null) return;
  String groupName = root.getButtonGroupName(component);
  if (groupName != null) {
    final String[] sameGroupComponents = root.getButtonGroupComponentIds(groupName);
    for(String id: sameGroupComponents) {
      final IComponent otherComponent = FormEditingUtil.findComponent(root, id);
      if (otherComponent != null && otherComponent != component) {
        return;
      }
    }
    collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.one.button.group.error"));
  }
}
项目:tools-idea    文件:CustomCreateProperty.java   
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);
      }
    }
  }
}
项目:tools-idea    文件:ListenerNavigateButton.java   
@Nullable
public static DefaultActionGroup prepareActionGroup(final RadComponent component) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String classToBind = root == null ? null : root.getClassToBind();
  if (classToBind != null) {
    final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), classToBind);
    if (aClass != null) {
      final PsiField boundField = aClass.findFieldByName(component.getBinding(), false);
      if (boundField != null) {
        return buildNavigateActionGroup(component, boundField);
      }
    }
  }
  return null;
}
项目:tools-idea    文件:NoButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  if (FormInspectionUtil.isComponentClass(module, component, JRadioButton.class)) {
    final IRootContainer root = FormEditingUtil.getRoot(component);
    if (root == null) return;
    if (root.getButtonGroupName(component) == null) {
      EditorQuickFixProvider quickFixProvider = null;
      IContainer parent = component.getParentContainer();
      for(int i=0; i<parent.getComponentCount(); i++) {
        IComponent child = parent.getComponent(i);
        if (child != component &&
            FormInspectionUtil.isComponentClass(module, child, JRadioButton.class)) {
          final GridConstraints c1 = component.getConstraints();
          final GridConstraints c2 = child.getConstraints();
          if (areCellsAdjacent(parent, c1, c2)) {
            final String groupName = root.getButtonGroupName(child);
            if (groupName == null) {
              quickFixProvider = new EditorQuickFixProvider() {
                 public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                   return new CreateGroupQuickFix(editor, component, c1.getColumn() == c2.getColumn());
                 }
               };
              break;
            }
            else {
              quickFixProvider = new EditorQuickFixProvider() {
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                  return new AddToGroupQuickFix(editor, component, groupName);
                }
              };
            }
          }
        }
      }
      collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.no.button.group.error"), quickFixProvider);
    }
  }
}
项目:tools-idea    文件:OneButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  if (root == null) return;
  String groupName = root.getButtonGroupName(component);
  if (groupName != null) {
    final String[] sameGroupComponents = root.getButtonGroupComponentIds(groupName);
    for(String id: sameGroupComponents) {
      final IComponent otherComponent = FormEditingUtil.findComponent(root, id);
      if (otherComponent != null && otherComponent != component) {
        return;
      }
    }
    collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.one.button.group.error"));
  }
}
项目:consulo-ui-designer    文件:FormEditingUtil.java   
public static IRootContainer getRoot(IComponent component)
{
    while(component != null)
    {
        if(component.getParentContainer() instanceof IRootContainer)
        {
            return (IRootContainer) component.getParentContainer();
        }
        component = component.getParentContainer();
    }
    return null;
}
项目:consulo-ui-designer    文件:FormEditingUtil.java   
public static Locale[] collectUsedLocales(final Module module, final IRootContainer rootContainer)
{
    final Set<Locale> locales = new HashSet<Locale>();
    final PropertiesReferenceManager propManager = PropertiesReferenceManager.getInstance(module.getProject());
    for(String bundleName : collectUsedBundleNames(rootContainer))
    {
        List<PropertiesFile> propFiles = propManager.findPropertiesFiles(module, bundleName.replace('/', '.'));
        for(PropertiesFile propFile : propFiles)
        {
            locales.add(propFile.getLocale());
        }
    }
    return locales.toArray(new Locale[locales.size()]);
}
项目:consulo-ui-designer    文件:FormEditingUtil.java   
@Nullable
public static IButtonGroup findGroupForComponent(final IRootContainer radRootContainer, @NotNull final IComponent component)
{
    for(IButtonGroup group : radRootContainer.getButtonGroups())
    {
        for(String id : group.getComponentIds())
        {
            if(component.getId().equals(id))
            {
                return group;
            }
        }
    }
    return null;
}
项目:consulo-ui-designer    文件:CustomCreateProperty.java   
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);
      }
    }
  }
}
项目:consulo-ui-designer    文件:ListenerNavigateButton.java   
@Nullable
public static DefaultActionGroup prepareActionGroup(final RadComponent component) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String classToBind = root == null ? null : root.getClassToBind();
  if (classToBind != null) {
    final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), classToBind);
    if (aClass != null) {
      final PsiField boundField = aClass.findFieldByName(component.getBinding(), false);
      if (boundField != null) {
        return buildNavigateActionGroup(component, boundField);
      }
    }
  }
  return null;
}
项目:consulo-ui-designer    文件:NoButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  if (FormInspectionUtil.isComponentClass(module, component, JRadioButton.class)) {
    final IRootContainer root = FormEditingUtil.getRoot(component);
    if (root == null) return;
    if (root.getButtonGroupName(component) == null) {
      EditorQuickFixProvider quickFixProvider = null;
      IContainer parent = component.getParentContainer();
      for(int i=0; i<parent.getComponentCount(); i++) {
        IComponent child = parent.getComponent(i);
        if (child != component &&
            FormInspectionUtil.isComponentClass(module, child, JRadioButton.class)) {
          final GridConstraints c1 = component.getConstraints();
          final GridConstraints c2 = child.getConstraints();
          if (areCellsAdjacent(parent, c1, c2)) {
            final String groupName = root.getButtonGroupName(child);
            if (groupName == null) {
              quickFixProvider = new EditorQuickFixProvider() {
                 public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                   return new CreateGroupQuickFix(editor, component, c1.getColumn() == c2.getColumn());
                 }
               };
              break;
            }
            else {
              quickFixProvider = new EditorQuickFixProvider() {
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                  return new AddToGroupQuickFix(editor, component, groupName);
                }
              };
            }
          }
        }
      }
      collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.no.button.group.error"), quickFixProvider);
    }
  }
}
项目:consulo-ui-designer    文件:OneButtonGroupInspection.java   
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
  final IRootContainer root = FormEditingUtil.getRoot(component);
  if (root == null) return;
  String groupName = root.getButtonGroupName(component);
  if (groupName != null) {
    final String[] sameGroupComponents = root.getButtonGroupComponentIds(groupName);
    for(String id: sameGroupComponents) {
      final IComponent otherComponent = FormEditingUtil.findComponent(root, id);
      if (otherComponent != null && otherComponent != component) {
        return;
      }
    }
    collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.one.button.group.error"));
  }
}
项目:intellij-ce-playground    文件:ErrorAnalyzer.java   
public static void analyzeErrors(final GuiEditor editor, final IRootContainer rootContainer, @Nullable final ProgressIndicator progress) {
  analyzeErrors(editor.getModule(), editor.getFile(), editor, rootContainer, progress);
}
项目:intellij-ce-playground    文件:BindingEditor.java   
private static String[] getFieldNames(final RadComponent component, final String currentName) {
  final ArrayList<String> result = new ArrayList<String>();
  if (currentName != null){
    result.add(currentName);
  }

  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String className = root.getClassToBind();
  if (className == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), className);
  if (aClass == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (field.hasModifierProperty(PsiModifier.STATIC)) {
      continue;
    }

    final String fieldName = field.getName();

    if (Comparing.equal(currentName, fieldName)) {
      continue;
    }

    if (!FormEditingUtil.isBindingUnique(component, fieldName, root)) {
      continue;
    }

    final String componentClassName;
    if (component instanceof RadErrorComponent) {
      componentClassName = component.getComponentClassName();
    }
    else if (component instanceof RadHSpacer || component instanceof RadVSpacer) {
      componentClassName = Spacer.class.getName();
    }
    else {
      componentClassName = component.getComponentClass().getName();
    }

    final PsiType componentType;
    try {
      componentType =
        JavaPsiFacade.getInstance(component.getProject()).getElementFactory().createTypeFromText(componentClassName, null);
    }
    catch (IncorrectOperationException e) {
      continue;
    }

    final PsiType fieldType = field.getType();
    if (!fieldType.isAssignableFrom(componentType)) {
      continue;
    }

    result.add(fieldName);
  }

  String text = FormInspectionUtil.getText(component.getModule(), component);
  if (text != null) {
    String binding = BindingProperty.suggestBindingFromText(component, text);
    if (binding != null && !result.contains(binding)) {
      result.add(binding);        
    }
  }

  final String[] names = ArrayUtil.toStringArray(result);
  Arrays.sort(names);
  return names;
}
项目:intellij-ce-playground    文件:BaseFormInspection.java   
public void startCheckForm(IRootContainer rootContainer) {
}
项目:intellij-ce-playground    文件:BaseFormInspection.java   
public void doneCheckForm(IRootContainer rootContainer) {
}
项目:tools-idea    文件:ErrorAnalyzer.java   
public static void analyzeErrors(final GuiEditor editor, final IRootContainer rootContainer, @Nullable final ProgressIndicator progress) {
  analyzeErrors(editor.getModule(), editor.getFile(), editor, rootContainer, progress);
}
项目:tools-idea    文件:BindingEditor.java   
private static String[] getFieldNames(final RadComponent component, final String currentName) {
  final ArrayList<String> result = new ArrayList<String>();
  if (currentName != null){
    result.add(currentName);
  }

  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String className = root.getClassToBind();
  if (className == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), className);
  if (aClass == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (field.hasModifierProperty(PsiModifier.STATIC)) {
      continue;
    }

    final String fieldName = field.getName();

    if (Comparing.equal(currentName, fieldName)) {
      continue;
    }

    if (!FormEditingUtil.isBindingUnique(component, fieldName, root)) {
      continue;
    }

    final String componentClassName;
    if (component instanceof RadErrorComponent) {
      componentClassName = component.getComponentClassName();
    }
    else if (component instanceof RadHSpacer || component instanceof RadVSpacer) {
      componentClassName = Spacer.class.getName();
    }
    else {
      componentClassName = component.getComponentClass().getName();
    }

    final PsiType componentType;
    try {
      componentType =
        JavaPsiFacade.getInstance(component.getProject()).getElementFactory().createTypeFromText(componentClassName, null);
    }
    catch (IncorrectOperationException e) {
      continue;
    }

    final PsiType fieldType = field.getType();
    if (!fieldType.isAssignableFrom(componentType)) {
      continue;
    }

    result.add(fieldName);
  }

  String text = FormInspectionUtil.getText(component.getModule(), component);
  if (text != null) {
    String binding = BindingProperty.suggestBindingFromText(component, text);
    if (binding != null && !result.contains(binding)) {
      result.add(binding);        
    }
  }

  final String[] names = ArrayUtil.toStringArray(result);
  Arrays.sort(names);
  return names;
}
项目:tools-idea    文件:BaseFormInspection.java   
public void startCheckForm(IRootContainer rootContainer) {
}
项目:tools-idea    文件:BaseFormInspection.java   
public void doneCheckForm(IRootContainer rootContainer) {
}
项目:consulo-ui-designer    文件:ErrorAnalyzer.java   
public static void analyzeErrors(final GuiEditor editor, final IRootContainer rootContainer, @Nullable final ProgressIndicator progress) {
  analyzeErrors(editor.getModule(), editor.getFile(), editor, rootContainer, progress);
}
项目:consulo-ui-designer    文件:BaseFormInspection.java   
public void startCheckForm(IRootContainer rootContainer) {
}
项目:consulo-ui-designer    文件:BaseFormInspection.java   
public void doneCheckForm(IRootContainer rootContainer) {
}
项目:intellij-ce-playground    文件:FormInspectionTool.java   
void startCheckForm(IRootContainer radRootContainer);
项目:intellij-ce-playground    文件:FormInspectionTool.java   
void doneCheckForm(IRootContainer radRootContainer);
项目:tools-idea    文件:FormInspectionTool.java   
void startCheckForm(IRootContainer radRootContainer);
项目:tools-idea    文件:FormInspectionTool.java   
void doneCheckForm(IRootContainer radRootContainer);
项目:consulo-ui-designer    文件:FormInspectionTool.java   
void startCheckForm(IRootContainer radRootContainer);
项目:consulo-ui-designer    文件:FormInspectionTool.java   
void doneCheckForm(IRootContainer radRootContainer);