VirtualFilePointer () { TreePath path = myTree.getSelectionPath(); if (path == null) return null; AbstractTreeNode treeNode = (AbstractTreeNode)path.getLastPathComponent(); return treeNode instanceof FileTreeNode ? ((FileTreeNode)treeNode).getFilePointer() : null; }