コード例 #1
0
 private static void cleanupQueueForModal(@NotNull final Object modalEntity) {
   synchronized (LOCK) {
     for (Iterator<RunnableInfo> iterator = ourQueue.iterator(); iterator.hasNext(); ) {
       RunnableInfo runnableInfo = iterator.next();
       if (runnableInfo.modalityState instanceof ModalityStateEx) {
         ModalityStateEx stateEx = (ModalityStateEx) runnableInfo.modalityState;
         if (stateEx.contains(modalEntity)) {
           ourForcedFlushQueue.add(runnableInfo);
           iterator.remove();
         }
       }
     }
   }
 }
コード例 #2
0
  @NotNull
  static ModalityStateEx modalityStateForWindow(@NotNull Window window) {
    int index = ourModalEntities.indexOf(window);
    if (index < 0) {
      Window owner = window.getOwner();
      if (owner == null) {
        return (ModalityStateEx) ApplicationManager.getApplication().getNoneModalityState();
      }
      ModalityStateEx ownerState = modalityStateForWindow(owner);
      if (window instanceof Dialog && ((Dialog) window).isModal()) {
        return ownerState.appendEntity(window);
      }
      return ownerState;
    }

    List<Object> result = new ArrayList<Object>();
    for (Object entity : ourModalEntities) {
      if (entity instanceof Window
          || entity instanceof ProgressIndicator && ((ProgressIndicator) entity).isModal()) {
        result.add(entity);
      }
    }
    return new ModalityStateEx(result.toArray());
  }