void () { final Document document = myEditor.getDocument(); final VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file != null && !IntentionPreviewUtils.isIntentionPreviewActive() && ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(Collections.singletonList(file)).hasReadonlyFiles()) { return; } CommandProcessor.getInstance().executeCommand(myProject, this::performInCommand, CodeInsightBundle.message("command.wrap.with.template"), "Wrap with template " + myTemplate.getKey()); }