VirtualFile () { for (ExternalSystemNode each : getSelectedNodes(ExternalSystemNode.class)) { VirtualFile file = each.getVirtualFile(); if (file != null && file.isValid()) return file; } final ProjectNode projectNode = getSelectedProjectNode(); if (projectNode == null) return null; VirtualFile file = projectNode.getVirtualFile(); if (file == null || !file.isValid()) return null; return file; }