@Override
	public boolean applyReference() {
		if (!isValidState) {
			throw new IllegalStateException();
		}

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

		String libraryProgramPathname = extLibPath.getText();

		Address addr = extAddr.getAddress();
		String label = extLabel.getText();
		if (label != null) {
			label = label.trim();
		}
		if (addr == null && extAddr.hasInput()) {
			AddressSpace space = extAddr.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;
		}

// FIXME The following needs to handle labels in external namespaces too.
		if (editRef != null) {
			return plugin.updateReference(editRef, fromCodeUnit, name, libraryProgramPathname, addr,
				label);
		}
		return plugin.addReference(fromCodeUnit, opIndex, name, libraryProgramPathname, addr,
			label);
	}
Pop up the data tree dialog so the user can choose the external program.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditExternalReferencePanel.java