Пример #1
0
  public void invokeAndWait(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
    if (isDispatchThread()) {
      LOG.error("invokeAndWait must not be called from event queue thread");
      runnable.run();
      return;
    }

    if (isExceptionalThreadWithReadAccess()) { // OK if we're in exceptional thread.
      LaterInvocator.invokeAndWait(runnable, modalityState);
      return;
    }

    if (myActionsLock.isReadLockAcquired()) {
      LOG.error("Calling invokeAndWait from read-action leads to possible deadlock.");
    }

    LaterInvocator.invokeAndWait(runnable, modalityState);
  }
Пример #2
0
 @NotNull
 public ModalityState getModalityStateForComponent(@NotNull Component c) {
   Window window = c instanceof Window ? (Window) c : SwingUtilities.windowForComponent(c);
   if (window == null) return getNoneModalityState(); // ?
   return LaterInvocator.modalityStateForWindow(window);
 }
Пример #3
0
 @NotNull
 public ModalityState getCurrentModalityState() {
   Object[] entities = LaterInvocator.getCurrentModalEntities();
   return entities.length > 0 ? new ModalityStateEx(entities) : getNoneModalityState();
 }