boolean (Collection<? extends Type> itemsToProcess, Project project) { if (DEBUG) trace("enter processAll"); try { boolean hasMoreToProcess; boolean allItemsProcessed = true; do { hasMoreToProcess = false; if (DEBUG) trace("observing " + itemsToProcess.size()); // todo we can decrease itemsToProcess for (Type item : itemsToProcess) { myUpdateSemaphore.down(); try { if (DEBUG) trace("about to process"); boolean processed = process(item, project); if (DEBUG) trace(processed ? "processed " : "skipped"); if (!processed) { hasMoreToProcess = true; allItemsProcessed = false; } } finally { myUpdateSemaphore.up(); } ProgressManager.checkCanceled(); } do { ProgressManager.checkCanceled(); } while (!myUpdateSemaphore.waitFor(500)); if (DEBUG) if (hasMoreToProcess) trace("reiterating"); } while (hasMoreToProcess); return allItemsProcessed; } finally { if (DEBUG) trace("exits processAll"); } }