private void clearWhenNoSelection(ClearOptions options, ProgramLocation location,
			Program program) {
		if (location == null) {
			return;
		}

		int[] compPath = location.getComponentPath();
		if (compPath != null && compPath.length > 0) {
			clearStructure(program, location, null);
			return;
		}

		CodeUnit cu = program.getListing().getCodeUnitContaining(location.getAddress());
		Command<Program> cmd = new ClearCmd(cu, options);
		tool.execute(cmd, program);
	}
Plugin that manages the 'clear' and 'clear with options' operations on a program.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java