當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。