void () { suggestedFileList.getSelectedValuesList().forEach(methodName -> { WriteCommandAction.runWriteCommandAction(project, (Runnable)() -> currentClass.add( PsiElementFactory.getInstance(project).createMethodFromText(getSelectedModifier() + "void " + methodName + "(){ }", currentClass)) ); }); super.doOKAction(); }