Replaced boilerplate code with NavigationUtil.activateFileWithPsiElement.
Renamed all references of 'method' to 'function'.