private Element savePreferencesToXML() {

		Element toolPreferencesElement = new Element(TOOL_PREFERENCES_XML_NAME);

		Set<Entry<String, Supplier<PreferenceState>>> entrySet = preferenceStateMap.entrySet();
		for (Entry<String, Supplier<PreferenceState>> entry : entrySet) {
			String key = entry.getKey();
			Supplier<PreferenceState> supplier = entry.getValue();
			PreferenceState state = supplier.get();
			if (state == null) {
				continue;
			}
			Element preferenceElement = state.saveToXml();
			preferenceElement.setAttribute("NAME", key);
			toolPreferencesElement.addContent(preferenceElement);
		}

		return toolPreferencesElement;
	}
Invoked by associated docking windows when they become active or inactive

@param window the active window
@param active true signals that this DockingWindowManager has become active
Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java