@Override
	public void run(TaskMonitor monitor) {
		if (programs.isEmpty()) {
			return;
		}

		monitor.initialize(programs.size());

		List<Program> validPrograms = null;
		AnalysisOptions prototypeAnalysisOptions = null;
		Options options = tool.getOptions(GhidraOptions.CATEGORY_AUTO_ANALYSIS);
		boolean showDialog = options.getBoolean("Show Analysis Options", true);
		if (showDialog) {
			try {
				validPrograms = checkForInvalidProgramsByArchitecture();
			}
			catch (CancelledException e) {
				return;  // no need to log this - it's a valid condition
			}

			if (!setOptions(prototypeProgram)) {
				return;
			}

			prototypeAnalysisOptions = new AnalysisOptions(prototypeProgram);
		}
		else {
			// no options dialog--analyze all programs
			validPrograms = new ArrayList<>(programs);
		}

		analyzePrograms(prototypeAnalysisOptions, validPrograms, monitor);
	}
The program that is used for a source of analysis options
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalyzeAllOpenProgramsTask.java