using QC.QsprTestObjects.Registry;

namespace QC.QTMApplication;

public class RegistryTreeBrowser
{
	public static void CollapseAll(QTMTestContainer testContainer)
	{
		foreach (QTMTestContainerItem item in testContainer.UserInterfaceProperties.Items)
		{
			CollapseAll(item);
		}
		testContainer.Expanded = false;
	}

	public static void CollapseAll(QTMTestContainerItem testContainerItem)
	{
		testContainerItem.Expanded = false;
		foreach (QTMTestContainerItem item in testContainerItem.Items)
		{
			CollapseAll(item);
		}
	}

	public static void Collapse(QTMRegistry qtmRegistry)
	{
		qtmRegistry.Expanded = false;
	}

	public static void Expand(QTMRegistry qtmRegistry)
	{
		qtmRegistry.Expanded = true;
	}

	public static void ExpandAll(QTMRegistry qtmRegistry)
	{
		Expand(qtmRegistry);
		foreach (QTMTarget item in qtmRegistry.Target)
		{
			ExpandAll(item);
		}
	}

	public static void ExpandAll(QTMTarget qtmTarget)
	{
		qtmTarget.Expanded = true;
		foreach (QTMTestContainer testContainer in qtmTarget.TestContainers)
		{
			ExpandAll(testContainer);
		}
	}

	public static void ExpandAll(QTMTestContainer testContainer)
	{
		foreach (QTMTestContainerItem item in testContainer.UserInterfaceProperties.Items)
		{
			ExpandAll(item);
		}
		testContainer.Expanded = true;
	}

	public static void ExpandAll(QTMTestContainerItem testContainerItem)
	{
		testContainerItem.Expanded = true;
		foreach (QTMTestContainerItem item in testContainerItem.Items)
		{
			ExpandAll(item);
		}
	}
}
