public static void closeSaveChangesDialog() {
		waitForSwing();
		OptionDialog dialog = getDialogComponent(OptionDialog.class);
		if (dialog == null) {
			return;
		}

		String title = dialog.getTitle();
		boolean isSavePrompt = StringUtils.containsAny(title, "Changed", "Saved");
		if (!isSavePrompt) {
			throw new AssertionError("Unexpected dialog with title '" + title + "'; " +
				"Expected a dialog alerting to program changes");
		}

		if (StringUtils.contains(title, "Program Changed")) {
			// the program is read-only or not in a writable project
			pressButtonByText(dialog, "Continue");
			return;
		}

		if (StringUtils.contains(title, "Save Program?")) {
			pressButtonByText(dialog, "Cancel");
			return;
		}

		throw new AssertionError("Unexpected dialog with title '" + title + "'; " +
			"Expected a dialog alerting to program changes");
	}
Will try to close dialogs prompting for changes to be saved, whether from program changes
or from tool config changes.
Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java