public ProgramNode getLeadSelectedNode() {
		ProgramNode node = getSingleSelectedNode();
		if (node != null) {
			return node; // only one node selected 
		}

		ProgramDnDTree tree = getTree();
		if (tree == null) {
			return null;
		}

		int n = tree.getSelectionCount();
		if (n == 0) {
			return null;
		}

		TreePath path = tree.getSelectionPath();
		if (n > 1) {
			path = tree.getLeadSelectionPath();
		}
		return (ProgramNode) path.getLastPathComponent();
	}
A context object for the {@link ProgramTreePlugin}.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeActionContext.java