use of com.intellij.codeInsight.template.impl.TemplateState in project kotlin by JetBrains.
the class KotlinInplaceVariableIntroducer method buildTemplateAndStart.
@Override
protected boolean buildTemplateAndStart(Collection<PsiReference> refs, Collection<Pair<PsiElement, TextRange>> stringUsages, PsiElement scope, PsiFile containingFile) {
myEditor.putUserData(INTRODUCE_RESTART, false);
//noinspection ConstantConditions
myEditor.getCaretModel().moveToOffset(getNameIdentifier().getTextOffset());
boolean result = super.buildTemplateAndStart(refs, stringUsages, scope, containingFile);
TemplateState templateState = TemplateManagerImpl.getTemplateState(InjectedLanguageUtil.getTopLevelEditor(myEditor));
if (templateState != null && myDeclaration.getTypeReference() != null) {
templateState.addTemplateStateListener(SpecifyTypeExplicitlyIntention.Companion.createTypeReferencePostprocessor(myDeclaration));
}
return result;
}
use of com.intellij.codeInsight.template.impl.TemplateState in project kotlin by JetBrains.
the class KotlinInplaceVariableIntroducer method stopIntroduce.
public void stopIntroduce() {
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
if (templateState != null) {
Runnable runnable = new Runnable() {
@Override
public void run() {
templateState.gotoEnd(true);
}
};
CommandProcessor.getInstance().executeCommand(myProject, runnable, getCommandName(), getCommandName());
}
}
Aggregations