void doSetProgram(Program newProgram) {
		controller.clear();
		if (program != null) {
			program.removeListener(programListener);
		}

		program = newProgram;
		currentLocation = null;
		currentSelection = null;
		if (program != null) {
			program.addListener(programListener);
			ToolOptions fieldOptions = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
			ToolOptions opt = tool.getOptions(OPTIONS_TITLE);
			decompilerOptions.grabFromToolAndProgram(fieldOptions, opt, program);
		}

		clipboardProvider.setProgram(program);
	}
Sets the current program and adds/removes itself as a domainObjectListener

@param newProgram the new program or null to clear out the current program.
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java