PsiIfStatement (String varName) { if (myFirstExitStatementCopy instanceof PsiReturnStatement && ((PsiReturnStatement)myFirstExitStatementCopy).getReturnValue() != null) { return (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) return null;", null); } return (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) " + myFirstExitStatementCopy.getText(), null); }