private void updateExternalLocation(ExternalLocation extLocation, String libraryName,
			String libraryProgramPathname, String label, Address addr)
			throws InvalidInputException, DuplicateNameException {
		int txId = program.startTransaction("Create External Location");
		boolean success = false;
		try {
			Library library = getOrCreateExternalLibrary(libraryName, libraryProgramPathname);

			// If the external location is not in the chosen library then move it.
			Symbol symbol = extLocation.getSymbol();
			Namespace parentNamespace = symbol.getParentNamespace();
			if (parentNamespace != library) {
				try {
					symbol.setNamespace(library);
				}
				catch (CircularDependencyException e) {
					throw new AssertException("Unexpected error", e);
				}
			}

			// Update the location.
			extLocation.setLocation(label, addr, SourceType.USER_DEFINED);

			success = true;
		}
		finally {
			program.endTransaction(txId, success);
		}
	}
Pop up the data tree dialog so the user can choose the external program.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/EditExternalLocationPanel.java