end template in tests as normal; if template was canceled - don't perform onSuccess method setup (IDEA-157973)

This commit is contained in:
Anna Kozlova
2016-07-08 10:50:23 +02:00
parent 185b889f35
commit b88d3c2d5a
3 changed files with 4 additions and 3 deletions
@@ -259,6 +259,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
startTemplate(newEditor, template, project, new TemplateEditingAdapter() {
@Override
public void templateFinished(Template template, boolean brokenOff) {
if (brokenOff) return;
WriteCommandAction.runWriteCommandAction(project, () -> {
PsiDocumentManager.getInstance(project).commitDocument(newEditor.getDocument());
final int offset = newEditor.getCaretModel().getOffset();