private void lockDocument(IProgressMonitor monitor, IJobManager jobMgr, ISchedulingRule rule) { if (rule != null) { jobMgr.beginRule(rule, monitor); } else synchronized (fDocumentAccessorLock) { while (fDocumentLocked) { try { fDocumentAccessorLock.wait(); } catch (InterruptedException e) { // nobody interrupts us! throw new OperationCanceledException(); } } fDocumentLocked = true; } }