String (EditorTextField textField) { final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(myFileType); if (profile != null) { final Document document = textField.getDocument(); final String pattern = ReadAction.compute(() -> { final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document); assert file != null; return profile.getCodeFragmentText(file); }); return pattern.isEmpty() ? textField.getText() : pattern; } return textField.getText(); }