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(); } }
public void addProgress(@NotNull ProgressIndicatorEx original, @NotNull TaskInfo info) { synchronized (myOriginals) { final boolean veryFirst = !hasProgressIndicators(); myOriginals.add(original); myInfos.add(info); final InlineProgressIndicator expanded = createInlineDelegate(info, original, false); final InlineProgressIndicator compact = createInlineDelegate(info, original, true); myPopup.addIndicator(expanded); myProgressIcon.resume(); if (veryFirst && !myPopup.isShowing()) { buildInInlineIndicator(compact); } else { buildInProcessCount(); if (myInfos.size() > 1 && Registry.is("ide.windowSystem.autoShowProcessPopup")) { openProcessPopup(false); } } runQuery(); } }
private void openProcessPopup(boolean requestFocus) { synchronized (myOriginals) { if (myPopup.isShowing()) return; if (hasProgressIndicators()) { myShouldClosePopupAndOnProcessFinish = true; buildInProcessCount(); } else { myShouldClosePopupAndOnProcessFinish = false; restoreEmptyStatus(); } myPopup.show(requestFocus); } }
void hideProcessPopup() { synchronized (myOriginals) { if (!myPopup.isShowing()) return; if (myOriginals.size() == 1) { buildInInlineIndicator(createInlineDelegate(myInfos.get(0), myOriginals.get(0), true)); } else if (!hasProgressIndicators()) { restoreEmptyStatus(); } else { buildInProcessCount(); } myPopup.hide(); } }
private void triggerPopupShowing() { if (myPopup.isShowing()) { hideProcessPopup(); } else { openProcessPopup(true); } }
private void handle(MouseEvent e) { if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED)) { if (!myPopup.isShowing()) { openProcessPopup(true); } else { hideProcessPopup(); } } else if (e.isPopupTrigger()) { ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction("BackgroundTasks"); ActionManager.getInstance() .createActionPopupMenu(ActionPlaces.UNKNOWN, group) .getComponent() .show(e.getComponent(), e.getX(), e.getY()); } }
public boolean isProcessWindowOpen() { return myPopup.isShowing(); }