private void performOptionalCheckout(DomainFile domainFile, TaskMonitor monitor) {

		if (silent || noCheckout || !domainFile.canCheckout()) {
			return;
		}

		User user = domainFile.getParent().getProjectData().getUser();

		CheckoutDialog dialog = Swing.runNow(() -> new CheckoutDialog(domainFile, user));
		if (dialog.showDialog() == CheckoutDialog.CHECKOUT) {
			try {
				monitor.setMessage("Checking Out " + domainFile.getName());
				if (domainFile.checkout(dialog.exclusiveCheckout(), monitor)) {
					return;
				}
				Msg.showError(this, null, "Checkout Failed", "Exclusive checkout failed for: " +
					domainFile.getName() + "\nOne or more users have file checked out!");
			}
			catch (CancelledException e) {
				// we don't care, the task has been cancelled
			}
			catch (ExclusiveCheckoutException e) {
				Msg.showError(this, null, "Checkout Failed", e.getMessage());
			}
			catch (IOException e) {
				Msg.showError(this, null, "Error on Check Out", e.getMessage(), e);
			}
		}
	}
Opens the program for the given location.
This method is intended to be invoked from within a {@link Task} or for headless operations. 
@param locator the program location to open
@param monitor the TaskMonitor used for status and cancelling
@return the opened program or null if the operation failed or was cancelled
Ghidra/Features/Base/src/main/java/ghidra/app/util/task/ProgramOpener.java