private void analyzePrograms(AnalysisOptions prototypeAnalysisOptions,
			List<Program> validPrograms, TaskMonitor monitor) {

		// a bottom-up cancelled listener (this is to know when the user presses cancel on the
		// tool's cancel icon, not this task's)
		bottomUpCancelledListener = new BottomUpCancelledListener(monitor);
		topDownCancelledListener = new TopDownCancelledListener();
		monitor.addCancelledListener(topDownCancelledListener);

		for (int i = 0; i < validPrograms.size(); i++) {
			if (monitor.isCancelled()) {
				break;
			}

			Program program = validPrograms.get(i);
			if (program.isClosed()) {
				monitor.setProgress(i);
				continue;
			}

			monitor.setMessage("Analyzing " + program.getName() + "...");

			int id = program.startTransaction("analysis");
			try {
				AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(program);
				initializeAnalysisOptions(program, prototypeAnalysisOptions, manager);

				GhidraProgramUtilities.markProgramAnalyzed(program);

				analyzeStrategy.analyzeProgram(program, manager, monitor);
			}
			finally {
				program.endTransaction(id, true);
			}

			monitor.setProgress(i);
		}

		if (monitor.isCancelled()) {
			for (Program program : programs) {
				AutoAnalysisManager aam = AutoAnalysisManager.getAnalysisManager(program);
				aam.cancelQueuedTasks();
			}
		}
	}
The program that is used for a source of analysis options
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalyzeAllOpenProgramsTask.java