private boolean startProcessing() {
    LOG.assertTrue(Thread.holdsLock(myQueue));

    if (isProcessing || !myStarted) {
      return false;
    }
    isProcessing = true;
    final T item = myQueue.removeFirst();
    final Runnable runnable =
        () -> {
          if (myDeathCondition.value(null)) return;
          runSafely(() -> myProcessor.consume(item, myContinuationContext));
        };
    final Application application = ApplicationManager.getApplication();
    if (myThreadToUse == ThreadToUse.AWT) {
      final ModalityState state = myModalityState.remove(new MyOverrideEquals(item));
      if (state != null) {
        application.invokeLater(runnable, state);
      } else {
        application.invokeLater(runnable);
      }
    } else {
      application.executeOnPooledThread(runnable);
    }
    return true;
  }
Esempio n. 2
0
  public void doTranslate(PairConsumer<Integer, Integer> consumer) {
    final JBTabsPosition pos = myTabs.getTabsPosition();

    int dX = 0;
    int dXs = 0;
    int dY = 0;
    int dYs = 0;
    int selected = getSelectedOffset();
    int plain = getNonSelectedOffset();

    switch (pos) {
      case bottom:
        dY = -plain;
        dYs = -selected;
        break;
      case left:
        dX = plain;
        dXs = selected;
        break;
      case right:
        dX = -plain;
        dXs = -selected;
        break;
      case top:
        dY = plain;
        dYs = selected;
        break;
    }

    if (!myTabs.isDropTarget(myInfo)) {
      if (myTabs.getSelectedInfo() != myInfo) {
        consumer.consume(dX, dY);
      } else {
        consumer.consume(dXs, dYs);
      }
    }
  }
 public void processLivePackages(
     final @NotNull PairConsumer<String, VirtualFile> packageNameAndDirConsumer) {
   for (Map.Entry<String, VirtualFile> entry : myLivePackageNameToDirMap.entrySet()) {
     packageNameAndDirConsumer.consume(entry.getKey(), entry.getValue());
   }
 }