void (TreeSelectionEvent e) { final TreePath selectionPath = tree.getSelectionPath(); if (selectionPath != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)selectionPath.getLastPathComponent(); final Object userObject = node.getUserObject(); if (userObject instanceof AntTargetNodeDescriptor antBuildTarget) { mySelectedTarget = antBuildTarget.getAntTarget(); } else { mySelectedTarget = null; } } }