void (final ElementToWorkOn elementToWorkOn) { if (elementToWorkOn == null) { return; } if (elementToWorkOn.getExpression() == null && elementToWorkOn.getLocalVariable() == null) { ElementToWorkOn.showNothingSelectedErrorMessage(editor, getRefactoringName(), getHelpID(), project); return; } final boolean hasRunTemplate = LookupManager.getActiveLookup(editor) == null; if (elementToWorkOn.getExpression() == null) { final PsiLocalVariable localVariable = elementToWorkOn.getLocalVariable(); final boolean result = invokeImpl(project, localVariable, editor) && hasRunTemplate; if (result) { editor.getSelectionModel().removeSelection(); } } else { if (invokeImpl(project, elementToWorkOn.getExpression(), editor) && hasRunTemplate) { editor.getSelectionModel().removeSelection(); } } }