PsiFile () { if (myTabbedPane.getSelectedIndex() == 1) { return (PsiFile)myGotoByNamePanel.getChosenElement(); } else { final TreePath path = myTree.getSelectionPath(); if (path == null) return null; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final Object userObject = node.getUserObject(); if (!(userObject instanceof ProjectViewNode pvNode)) return null; VirtualFile vFile = pvNode.getVirtualFile(); if (vFile != null && !vFile.isDirectory()) { return PsiManager.getInstance(myProject).findFile(vFile); } return null; } }