public static boolean inModalState() {
		for (Window window : Window.getWindows()) {
			if (window instanceof Dialog) {
				Dialog dialog = (Dialog) window;
				if (dialog.isShowing()) {
					ModalityType type = dialog.getModalityType();
					if (type == ModalityType.APPLICATION_MODAL || type == ModalityType.TOOLKIT_MODAL) {
						return true;
					}
				}
			}
		}
		return false;
	}