@Override
	public void processEvent(PluginEvent event) {
		if (event instanceof ProgramActivatedPluginEvent) {
			ProgramActivatedPluginEvent ev = (ProgramActivatedPluginEvent) event;
			Program newProg = ev.getActiveProgram();
			if (currentProgram != null) {
				currentProgram.removeListener(this);
			}
			if (newProg != null) {
				newProg.addListener(this);
			}
		}
	}
Debug Plugin to show domain object change events.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/DomainEventDisplayPlugin.java