本文整理匯總了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"));
}
}
};
}
示例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]);
}
}
}
}
}
};
}