Search in sources :

Example 1 with ParameterTableModelItemBase

use of com.intellij.refactoring.changeSignature.ParameterTableModelItemBase in project kotlin by JetBrains.

the class KotlinCallableParameterTableModel method createRowItem.

@Override
protected ParameterTableModelItemBase<KotlinParameterInfo> createRowItem(@Nullable KotlinParameterInfo parameterInfo) {
    if (parameterInfo == null) {
        parameterInfo = new KotlinParameterInfo(methodDescriptor.getBaseDescriptor(), -1, "", new KotlinTypeInfo(false, null, null), null, null, KotlinValVar.None, null);
    }
    KtPsiFactory psiFactory = KtPsiFactoryKt.KtPsiFactory(project);
    PsiCodeFragment paramTypeCodeFragment = psiFactory.createTypeCodeFragment(KotlinTypeInfoKt.render(parameterInfo.getCurrentTypeInfo()), myTypeContext);
    KtExpression defaultValueForCall = parameterInfo.getDefaultValueForCall();
    PsiCodeFragment defaultValueCodeFragment = psiFactory.createExpressionCodeFragment(defaultValueForCall != null ? defaultValueForCall.getText() : "", myDefaultValueContext);
    return new ParameterTableModelItemBase<KotlinParameterInfo>(parameterInfo, paramTypeCodeFragment, defaultValueCodeFragment) {

        @Override
        public boolean isEllipsisType() {
            return false;
        }
    };
}
Also used : KtPsiFactory(org.jetbrains.kotlin.psi.KtPsiFactory) PsiCodeFragment(com.intellij.psi.PsiCodeFragment) KtExpression(org.jetbrains.kotlin.psi.KtExpression) ParameterTableModelItemBase(com.intellij.refactoring.changeSignature.ParameterTableModelItemBase)

Aggregations

PsiCodeFragment (com.intellij.psi.PsiCodeFragment)1 ParameterTableModelItemBase (com.intellij.refactoring.changeSignature.ParameterTableModelItemBase)1 KtExpression (org.jetbrains.kotlin.psi.KtExpression)1 KtPsiFactory (org.jetbrains.kotlin.psi.KtPsiFactory)1