private void setProgram(Program p) {

		Iterator<String> iter = providerMap.keySet().iterator();
		while (iter.hasNext()) {
			String treeName = iter.next();
			TreeViewProvider provider = providerMap.get(treeName);
			provider.setProgram(null);
		}
		iter = providerMap.keySet().iterator();
		while (iter.hasNext()) {
			String treeName = iter.next();
			TreeViewProvider provider = providerMap.get(treeName);
			deregisterService(ViewProviderService.class, provider);
		}
		providerMap.clear();
		actionManager.setProgram(p);
		if (p == null) {
			addDefaultProvider();
		}
		else {
			addTreeViews();
		}
	}
Set the program on each of the providers.

@param p program that is being opened; if p is null, then program is
           being closed.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java