コード例 #1
0
  private ProgressIndicatorEx removeFromMaps(@NotNull InlineProgressIndicator progress) {
    final ProgressIndicatorEx original = myInline2Original.get(progress);

    myInline2Original.remove(progress);

    myOriginal2Inlines.remove(original, progress);
    if (myOriginal2Inlines.get(original) == null) {
      final int originalIndex = myOriginals.indexOf(original);
      myOriginals.remove(originalIndex);
      myInfos.remove(originalIndex);
    }

    return original;
  }
コード例 #2
0
  @NotNull
  private InlineProgressIndicator createInlineDelegate(
      @NotNull TaskInfo info, @NotNull ProgressIndicatorEx original, final boolean compact) {
    final Collection<InlineProgressIndicator> inlines = myOriginal2Inlines.get(original);
    if (inlines != null) {
      for (InlineProgressIndicator eachInline : inlines) {
        if (eachInline.isCompact() == compact) return eachInline;
      }
    }

    final InlineProgressIndicator inline = new MyInlineProgressIndicator(compact, info, original);

    myInline2Original.put(inline, original);
    myOriginal2Inlines.put(original, inline);

    if (compact) {
      inline
          .getComponent()
          .addMouseListener(
              new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                  handle(e);
                }

                @Override
                public void mouseReleased(MouseEvent e) {
                  handle(e);
                }
              });
    }

    return inline;
  }
コード例 #3
0
  private void removeProgress(@NotNull InlineProgressIndicator progress) {
    synchronized (myOriginals) {
      if (!myInline2Original.containsKey(progress)) return;

      final boolean last = myOriginals.size() == 1;
      final boolean beforeLast = myOriginals.size() == 2;

      myPopup.removeIndicator(progress);

      final ProgressIndicatorEx original = removeFromMaps(progress);
      if (myOriginals.contains(original)) return;

      if (last) {
        restoreEmptyStatus();
        if (myShouldClosePopupAndOnProcessFinish) {
          hideProcessPopup();
        }
      } else {
        if (myPopup.isShowing() || myOriginals.size() > 1) {
          buildInProcessCount();
        } else if (beforeLast) {
          buildInInlineIndicator(createInlineDelegate(myInfos.get(0), myOriginals.get(0), true));
        } else {
          restoreEmptyStatus();
        }
      }

      runQuery();
    }
  }
コード例 #4
0
 @Override
 public void dispose() {
   setRefreshVisible(false);
   InlineProgressIndicator[] indicators =
       getCurrentInlineIndicators().toArray(new InlineProgressIndicator[0]);
   for (InlineProgressIndicator indicator : indicators) {
     Disposer.dispose(indicator);
   }
   myInline2Original.clear();
   myOriginal2Inlines.clear();
 }
コード例 #5
0
 @NotNull
 private Set<InlineProgressIndicator> getCurrentInlineIndicators() {
   synchronized (myOriginals) {
     return myInline2Original.keySet();
   }
 }