fDelegatedProgressMonitor.setDelegate(searchingMonitor);
searchingMonitor.beginTask(fCountingProgressMonitor.fTaskName, fCountingProgressMonitor.fTotalWork); double lastWorked= fCountingProgressMonitor.getWorked(); searchingMonitor.internalWorked(lastWorked);
	public static TypeInfo[] getAllTypes(IProgressMonitor monitor) {		if (monitor == null)			monitor= new NullProgressMonitor();		monitor.beginTask("", 10); //$NON-NLS-1$		SubProgressMonitor checkingMonitor = new SubProgressMonitor(monitor, 1);		SubProgressMonitor searchingMonitor= new SubProgressMonitor(monitor, 9);		forceDeltaComplete(checkingMonitor);		searchingMonitor.setTaskName(CorextMessages.getString("AllTypesCache.searching")); //$NON-NLS-1$				synchronized(fgLock) {			try {				if (fgTypeCache == null) {					// cache is empty										if (fgTypeCacherThread == null) {						// cache synchroneously						ArrayList searchResult= new ArrayList(fgSizeHint);						try {							fgIsLocked= true;							if (search(new TypeInfoRequestor(searchResult), IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, searchingMonitor)) {								TypeInfo[] result= (TypeInfo[]) searchResult.toArray(new TypeInfo[searchResult.size()]);								Arrays.sort(result, fgTypeNameComparator);								fgTypeCache= result;								fgSizeHint= result.length;							}						} finally {							fgIsLocked= false;						}						} else {						fDelegatedProgressMonitor.setDelegate(searchingMonitor);						// wait for the thread to finished						try {							while (fgTypeCache == null) {								fgLock.wait(CANCEL_POLL_INTERVAL);	// poll for cancel								if (searchingMonitor.isCanceled())									throw new OperationCanceledException();							}						} catch (InterruptedException e) {							JavaPlugin.log(e);						} finally {							fDelegatedProgressMonitor.setDelegate(null);												}					}				}							} finally {				monitor.done();			}			return fgTypeCache;		}	}