private DomainObject[] lockDomainObjects(List<DomainFile> files) {
		DomainObject[] domainObjects = new DomainObject[files.size()];
		int lastIndex = 0;
		boolean locked = true;
		while (lastIndex < files.size()) {
			try {
				domainObjects[lastIndex] =
					files.get(lastIndex).getDomainObject(this, false, false, null);
			}
			catch (Throwable t) {
				Msg.error(this, "Failed to aqcuire domain object instance", t);
				locked = false;
				break;
			}
			if (!domainObjects[lastIndex].lock(null)) {
				String title = "Exit Ghidra";
				StringBuffer buf = new StringBuffer();
				DomainObject d = domainObjects[lastIndex];
				buf.append("The File " + files.get(lastIndex).getPathname() +
					" is currently being modified by the\n");
				buf.append("the following actions:\n \n");
				TransactionInfo t = d.getCurrentTransactionInfo();
				List<String> list = t.getOpenSubTransactions();
				for (String element : list) {
					buf.append("\n     ");
					buf.append(element);
				}
				buf.append("\n \n");
				buf.append(
					"You may exit Ghidra, but the above action(s) will be aborted and all\n");
				buf.append("changes made by those actions (and all changes made since those\n");
				buf.append("actions started) will be lost!  You will still have the option of \n");
				buf.append("saving any changes made before those actions began.\n \n");
				buf.append("Do you want to abort the action(s) and exit Ghidra?");

				int result = OptionDialog.showOptionDialog(tool.getToolFrame(), title,
					buf.toString(), "Exit Ghidra", OptionDialog.WARNING_MESSAGE);

				if (result == OptionDialog.CANCEL_OPTION) {
					locked = false;
					domainObjects[lastIndex].release(this);
					break;
				}
				d.forceLock(true, null);
			}
			++lastIndex;
		}
		if (!locked) {
			//skip the last one that could not be locked...
			for (int i = 0; i < lastIndex; i++) {
				domainObjects[i].unlock();
				domainObjects[i].release(this);
			}
			return null;
		}
		return domainObjects;
	}
Obtain domain objects from files and lock.  If unable to lock 
one or more of the files, none are locked and null is returned.
@param files the files
@return locked domain objects, or null if unable to lock
all domain objects.
Ghidra/Framework/Project/src/main/java/ghidra/framework/main/FileActionManager.java