private void toggleDataRecursively(Data data, boolean openState, TaskMonitor monitor) {
		if (data == null && !monitor.isCancelled()) {
			return;
		}

		if (isOpen(data) != openState) {
			toggleTopLevelData(data);
		}
		int componentCount = data.getNumComponents();

		// if the data is an array and its elements are not the type that can be opened, then bail
		if (componentCount > 0 && data.isArray()) {
			Data component = data.getComponent(0);
			if (component.getNumComponents() == 0) {
				return;
			}
		}
		TaskMonitor noProgressMonitor = new NoProgressMonitor(monitor);
		for (int i = 0; i < componentCount && !monitor.isCancelled(); i++) {
			monitor.incrementProgress(1);
			toggleDataRecursivlyUsingSubMonitor(data.getComponent(i), openState, noProgressMonitor);
		}
	}
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