public boolean applyLocation() {
		if (!isValidState) {
			throw new IllegalStateException();
		}
		if (!validateChanges()) {
			return false;
		}

		String name = extLibNameComboBox.getText();
		if (name == null || name.trim().length() == 0) {
			showInputErr("An external program 'Name' must be specified.");
			return false;
		}
		name = name.trim();

		String libraryProgramPathname = extLibPathTextField.getText();

		Address addr = extAddressInputWidget.getAddress();
		String label = getLocationName();
		if (addr == null && extAddressInputWidget.hasInput()) {
			AddressSpace space = extAddressInputWidget.getAddressSpace();
			showInputErr("Invalid address specified, " + space.getName() +
				" offset must be in range: " + space.getMinAddress().toString(false) + " to " +
				space.getMaxAddress().toString(false));
			return false;
		}
		if (addr == null && (label == null || label.length() == 0)) {
			showInputErr(
				"Either (or both) an external 'Label' and/or 'Address' must be specified.");
			return false;
		}

		try {
			if (externalLocation != null) {
				updateExternalLocation(externalLocation, name, libraryProgramPathname, label, addr);
				return true;
			}

			ExternalLocation extLocation = addExternalLocation(externalLocation, name,
				libraryProgramPathname, label, addr, functionCheckBox.isSelected());
			return (extLocation != null);
		}
		catch (DuplicateNameException | InvalidInputException e) {
			showInputErr(e.getMessage());
		}
		return false;
	}
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