ProgramNode adjustSelectionForPopup(MouseEvent event) {

		synchronized (root) {

			if (event != null && event.getSource() != this) {
				return null;
			}

			Point popupPoint = event != null ? event.getPoint() : null;
			if (popupPoint != null) {
				return getMouseNode(popupPoint);
			}

			int nselected = getSelectionCount();
			if (nselected < 1) {
				return null; // nothing selected in the tree
			}

			TreePath activePath = getSelectionPath();
			return (ProgramNode) activePath.getLastPathComponent();
		}
	}
Adjust the selection based on the given popupPoint.
@param  event mouse event
@return node that is selected
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramDnDTree.java