static boolean progressBar(VirtualBoxManager mgr, IProgress p, long waitMillis) { long end = System.currentTimeMillis() + waitMillis; while (!p.getCompleted()) { mgr.waitForEvents(0); p.waitForCompletion(200); if (System.currentTimeMillis() >= end) return false; } return true; }