@Override public void updateUI(DartFunctionDescription p, ParameterInfoUIContext context) { if (p == null) { context.setUIComponentEnabled(false); return; } myParametersListPresentableText = p.getParametersListPresentableText(); context.setupUIComponentPresentation( myParametersListPresentableText, p.getParameterRange(context.getCurrentParameterIndex()).getStartOffset(), p.getParameterRange(context.getCurrentParameterIndex()).getEndOffset(), !context.isUIComponentEnabled(), false, false, context.getDefaultParameterColor()); }
@Override public void showParameterInfo(@NotNull PsiElement element, CreateParameterInfoContext context) { DartFunctionDescription functionDescription = null; if (element instanceof DartCallExpression) { functionDescription = DartFunctionDescription.tryGetDescription((DartCallExpression) element); } else if (element instanceof DartNewExpression) { final DartNewExpression newExpression = (DartNewExpression) element; final DartType type = newExpression.getType(); final DartClassResolveResult classResolveResult = DartResolveUtil.resolveClassByType(type); PsiElement psiElement = ((DartNewExpression) element).getReferenceExpression(); psiElement = psiElement == null && type != null ? type.getReferenceExpression() : psiElement; final PsiElement target = psiElement != null ? ((DartReference) psiElement).resolve() : null; if (target instanceof DartComponentName) { functionDescription = DartFunctionDescription.createDescription( (DartComponent) target.getParent(), classResolveResult); } } if (functionDescription != null && functionDescription.getParameters().length > 0) { context.setItemsToShow(new Object[] {functionDescription}); context.showHint(element, element.getTextRange().getStartOffset(), this); } }
@Override public Object[] getParametersForDocumentation( DartFunctionDescription p, ParameterInfoContext context) { return p.getParameters(); }