public static boolean isFromModalDialog(Project project) {
    final Component owner = IdeFocusManager.getInstance(project).getFocusOwner();
    if (owner != null) {
      final DialogWrapper instance = DialogWrapper.findInstance(owner);
      return instance != null && instance.isModal();
    }
    return false;
  }
public static boolean isFromModalDialog(Project project)