private void toggleAllDataInAddresses(boolean open, Program program, AddressSetView addresses,
			TaskMonitor monitor) {

		AddressSet unprocessed = new AddressSet(addresses);

		monitor.initialize(addresses.getNumAddresses());

		Listing listing = program.getListing();
		DataIterator iterator = listing.getDefinedData(addresses, true);
		while (iterator.hasNext()) {
			if (monitor.isCancelled()) {
				return;
			}

			Data data = iterator.next();

			toggleDataRecursively(data, open, monitor);

			Address min = data.getMinAddress();

			unprocessed.deleteFromMin(min);

			long progress = addresses.getNumAddresses() - unprocessed.getNumAddresses();
			monitor.setProgress(progress);
		}

		notifyDataToggled();
	}
Returns the index of the component that is open at the given address.
@param address the address to find the open index.
@param path the component path.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/util/OpenCloseManager.java