private static PsiNameValuePair createNameValuePair( @NotNull PsiAnnotationMemberValue value, @NotNull String namePrefix, @NotNull PairFunction<Project, String, PsiAnnotation> annotationCreator) { return annotationCreator .fun(value.getProject(), "@A(" + namePrefix + value.getText() + ")") .getParameterList() .getAttributes()[0]; }
private void performAction( @NotNull MouseEvent e, @NotNull PairFunction<Integer, Point, GraphAction> actionConstructor) { int row = PositionUtil.getRowIndex(e.getPoint()); if (row > getRowCount() - 1) { return; } Point point = calcPoint4Graph(e.getPoint()); GraphFacade graphFacade = myDataPack.getGraphFacade(); GraphAnswer answer = graphFacade.performAction(actionConstructor.fun(row, point)); myUI.handleAnswer(answer); }
@Nullable private static PsiType getQualifierCastType( PsiJavaReference javaReference, CompletionParameters parameters) { if (javaReference instanceof PsiReferenceExpression) { final PsiReferenceExpression refExpr = (PsiReferenceExpression) javaReference; final PsiExpression qualifier = refExpr.getQualifierExpression(); if (qualifier != null) { final Project project = qualifier.getProject(); PsiType type = null; final PairFunction<PsiExpression, CompletionParameters, PsiType> evaluator = refExpr.getContainingFile().getCopyableUserData(DYNAMIC_TYPE_EVALUATOR); if (evaluator != null) { type = evaluator.fun(qualifier, parameters); } if (type == null) { type = GuessManager.getInstance(project).getControlFlowExpressionType(qualifier); } return type; } } return null; }