private void run(ItemEvent e) {
			// There was a change in the set of selected vertices.  If the focused vertex is null,
			// set it from one of the selected vertices
			if (e.getStateChange() == ItemEvent.SELECTED) {
				Set<AttributedVertex> selectedVertices = getSelectedVertices();
				notifySelectionChanged(new HashSet<>(selectedVertices));

				if (selectedVertices.size() == 1) {
					// if only one vertex was selected, make it the focused vertex
					setFocusedVertex(selectedVertices.stream().findFirst().get());
				}
				else if (DefaultGraphDisplay.this.focusedVertex == null) {
					// if there is currently no focused Vertex, attempt to get
					// one from the selectedVertices
					setFocusedVertex(selectedVertices.stream().findFirst().orElse(null));
				}
			}
			else if (e.getStateChange() == ItemEvent.DESELECTED) {
				Set<AttributedVertex> selectedVertices = getSelectedVertices();
				notifySelectionChanged(selectedVertices);
			}
			viewer.repaint();
		}
Item listener for selection changes in the graph with the additional
capability of being able to disable the listener without removing it.
Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java