void (@NotNull Template template, boolean brokenOff) { final GrImportStatement importStatement = ReadAction .compute(() -> PsiTreeUtil.findElementOfClassAtOffset(file, range.getStartOffset(), GrImportStatement.class, true)); if (brokenOff) { if (importStatement != null) { ApplicationManager.getApplication().runWriteAction(() -> importStatement.delete()); } return; } updateRefs(usages, name, importStatement); ApplicationManager.getApplication().runWriteAction(() -> { final GrImportStatement context1 = PsiTreeUtil.findElementOfClassAtRange(file, contextImportPointer.getStartOffset(), contextImportPointer.getEndOffset(), GrImportStatement.class); if (context1 != null) { context1.delete(); } }); }