“+1. That's a great idea. Is there a programmatic way to tell
whether there are refresh operations still active?”
My IndexerSetupParticipant does the following to find out about the
refresh jobs:
private boolean refreshsPending() {
updateRefreshJobs(ResourcesPlugin.FAMILY_AUTO_REFRESH);
if (fRefreshJobs.size() != 0) {
return true;
}
updateRefreshJobs(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
if (fRefreshJobs.size() != 0) {
return true;
}
return false;
}
private void updateRefreshJobs(Object jobFamily) {
IJobManager jobManager = Job.getJobManager();
Job[] refreshJobs = jobManager.find(jobFamily);
if (refreshJobs != null) {
for (Job j : refreshJobs) {
if (!fRefreshJobs.contains(j))
{
// LATER
Here might be problem: if the job completes
// just in
this moment, we never get notified, and thus,
// never
will start the indexer (until the workbench is
//
restarted).
// Can we
use the join methods instead? Would require
// a
separate worker thread?
j.addJobChangeListener(fJobListener);
fRefreshJobs.add(j);
}
}
}
}
Jens.