Search in sources :

Example 1 with DartType

use of com.jetbrains.lang.dart.psi.DartType in project intellij-plugins by JetBrains.

the class CreateGetterSetterFix method buildFunctionsText.

@Override
protected Template buildFunctionsText(final TemplateManager templateManager, final DartComponent namedComponent) {
    final DartReturnType returnType = PsiTreeUtil.getChildOfType(namedComponent, DartReturnType.class);
    final DartType dartType = PsiTreeUtil.getChildOfType(namedComponent, DartType.class);
    final String typeText = returnType == null ? DartPresentableUtil.buildTypeText(namedComponent, dartType, null) : DartPresentableUtil.buildTypeText(namedComponent, returnType, null);
    final Template template = templateManager.createTemplate(getClass().getName(), DART_TEMPLATE_GROUP);
    template.setToReformat(true);
    if (myStrategy == Strategy.GETTER || myStrategy == Strategy.GETTERSETTER) {
        buildGetter(template, namedComponent.getName(), typeText, namedComponent.isStatic());
    }
    if (myStrategy == Strategy.SETTER || myStrategy == Strategy.GETTERSETTER) {
        buildSetter(template, namedComponent.getName(), typeText, namedComponent.isStatic());
    }
    return template;
}
Also used : DartType(com.jetbrains.lang.dart.psi.DartType) DartReturnType(com.jetbrains.lang.dart.psi.DartReturnType) Template(com.intellij.codeInsight.template.Template)

Aggregations

Template (com.intellij.codeInsight.template.Template)1 DartReturnType (com.jetbrains.lang.dart.psi.DartReturnType)1 DartType (com.jetbrains.lang.dart.psi.DartType)1