当前位置: 首页>>代码示例>>Java>>正文


Java FormEditingUtil.findClassToBind方法代码示例

本文整理汇总了Java中com.intellij.uiDesigner.FormEditingUtil.findClassToBind方法的典型用法代码示例。如果您正苦于以下问题:Java FormEditingUtil.findClassToBind方法的具体用法?Java FormEditingUtil.findClassToBind怎么用?Java FormEditingUtil.findClassToBind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.uiDesigner.FormEditingUtil的用法示例。


在下文中一共展示了FormEditingUtil.findClassToBind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSourceFile

import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private static VirtualFile findSourceFile(final CompileContext context, final VirtualFile formFile, final String className) {
  final Module module = context.getModuleByFile(formFile);
  if (module == null) {
    return null;
  }
  final PsiClass aClass = FormEditingUtil.findClassToBind(module, className);
  if (aClass == null) {
    return null;
  }

  final PsiFile containingFile = aClass.getContainingFile();
  if (containingFile == null){
    return null;
  }

  return containingFile.getVirtualFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:Form2SourceCompiler.java

示例2: setValueImpl

import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
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);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CustomCreateProperty.java

示例3: prepareActionGroup

import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ListenerNavigateButton.java

示例4: getFieldNames

import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:75,代码来源:BindingEditor.java


注:本文中的com.intellij.uiDesigner.FormEditingUtil.findClassToBind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。