當前位置: 首頁>>代碼示例>>Java>>正文


Java FormReferenceProvider類代碼示例

本文整理匯總了Java中com.intellij.uiDesigner.binding.FormReferenceProvider的典型用法代碼示例。如果您正苦於以下問題:Java FormReferenceProvider類的具體用法?Java FormReferenceProvider怎麽用?Java FormReferenceProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FormReferenceProvider類屬於com.intellij.uiDesigner.binding包,在下文中一共展示了FormReferenceProvider類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildVisitor

import com.intellij.uiDesigner.binding.FormReferenceProvider; //導入依賴的package包/類
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
  return new JavaElementVisitor() {
    @Override
    public void visitAssignmentExpression(PsiAssignmentExpression expression) {
      PsiExpression lExpression = expression.getLExpression();
      if (lExpression instanceof PsiReferenceExpression) {
        PsiReferenceExpression lExpr = (PsiReferenceExpression)lExpression;
        PsiElement lElement = lExpr.resolve();
        if (!(lElement instanceof PsiField)) {
          return;
        }
        PsiField field = (PsiField) lElement;
        PsiReference formReference = FormReferenceProvider.getFormReference(field);
        if (!(formReference instanceof FieldFormReference)) {
          return;
        }
        FieldFormReference ref = (FieldFormReference) formReference;
        if (ref.isCustomCreate()) {
          return;
        }

        PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class);
        if (method != null && AsmCodeGenerator.SETUP_METHOD_NAME.equals(method.getName())) {
          return;
        }
        holder.registerProblem(expression, UIDesignerBundle.message("inspection.bound.field.message"));
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:BoundFieldAssignmentInspection.java

示例2: buildVisitor

import com.intellij.uiDesigner.binding.FormReferenceProvider; //導入依賴的package包/類
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
  return new JavaElementVisitor() {
    @Override
    public void visitAssignmentExpression(PsiAssignmentExpression expression) {
      if (expression.getLExpression() instanceof PsiReferenceExpression) {
        PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class);
        if (method != null && AsmCodeGenerator.SETUP_METHOD_NAME.equals(method.getName())) {
          return;
        }
        PsiReferenceExpression lExpr = (PsiReferenceExpression) expression.getLExpression();
        PsiElement lElement = lExpr.resolve();
        if (lElement instanceof PsiField) {
          PsiField field = (PsiField) lElement;
          PsiReference formReference = FormReferenceProvider.getFormReference(field);
          if (formReference instanceof FieldFormReference) {
            FieldFormReference ref = (FieldFormReference) formReference;
            if (!ref.isCustomCreate()) {
              holder.registerProblem(expression, UIDesignerBundle.message("inspection.bound.field.message"),
                                     new LocalQuickFix[0]);
            }
          }
        }
      }
    }
  };
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:28,代碼來源:BoundFieldAssignmentInspection.java


注:本文中的com.intellij.uiDesigner.binding.FormReferenceProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。