private synchronized void replaceStubsAndNulls(@NotNull Map<ActionStubBase, AnAction> stubMap) {
    for (ListIterator<AnAction> it = mySortedChildren.listIterator(); it.hasNext();) {
      AnAction action = it.next();
      if (action == null) {
        LOG.error("Empty sorted child: " + this + ", " + getClass() + "; index=" + it.previousIndex());
        it.remove();
      }
      else if (action instanceof ActionStubBase) {
        AnAction replacement = stubMap.get((ActionStubBase)action);
        if (replacement != null) {
          it.set(replacement);
          replaceConstraint(action, replacement);
          replace(action, replacement);
        }
        else {
          myConstraints.remove(action);
          it.remove();
        }
      }
    }
    for (ListIterator<AnAction> it = myPendingActions.listIterator(); it.hasNext(); ) {
      AnAction action = it.next();
      if (action == null) {
        LOG.error("Empty pair child: " + this + ", " + getClass() + "; index=" + it.previousIndex());
        it.remove();
      }
      else if (action instanceof ActionStubBase) {
        AnAction replacement = stubMap.get((ActionStubBase)action);
        if (replacement != null) {
          it.set(replacement);
          replaceConstraint(action, replacement);
          replace(action, replacement);
        }
        else {
          myConstraints.remove(action);
          it.remove();
        }
      }
    }
  }
private synchronized void replaceStubsAndNulls(@NotNull Map<ActionStubBase, AnAction> stubMap)