use of bndtools.tasks.AnalyseBundleResolutionJob in project bndtools by bndtools.
the class ResolutionView method executeAnalysis.
void executeAnalysis() {
if (inputLocked)
return;
outOfDate = false;
synchronized (this) {
Job oldJob = analysisJob;
if (oldJob != null && oldJob.getState() != Job.NONE)
oldJob.cancel();
if (!loaders.isEmpty()) {
final AnalyseBundleResolutionJob job = new AnalyseBundleResolutionJob("importExportAnalysis", loaders);
job.setSystem(true);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void aboutToRun(IJobChangeEvent event) {
if (display != null && !display.isDisposed()) {
Runnable update = new Runnable() {
@Override
public void run() {
setContentDescription("Working...");
}
};
if (display.getThread() == Thread.currentThread())
update.run();
else
display.asyncExec(update);
}
}
@Override
public void done(IJobChangeEvent event) {
IStatus result = job.getResult();
if (result != null && result.isOK()) {
if (display != null && !display.isDisposed())
display.asyncExec(new Runnable() {
@Override
public void run() {
setInput(loaders, job.getCapabilities(), job.getRequirements());
}
});
}
}
});
analysisJob = job;
analysisJob.schedule(500);
} else {
analysisJob = null;
}
}
}
use of bndtools.tasks.AnalyseBundleResolutionJob in project bndtools by bndtools.
the class BundleCalculatedImportsPart method refresh.
@Override
public void refresh() {
super.refresh();
IFile file = getEditorFile();
if (file == null)
return;
IPath location = file.getLocation();
if (location == null)
return;
Set<BndFileCapReqLoader> loaders = Collections.singleton(new BndFileCapReqLoader(location.toFile()));
final AnalyseBundleResolutionJob job = new AnalyseBundleResolutionJob(Messages.BundleCalculatedImportsPart_jobAnalyse, loaders);
final Display display = tree.getDisplay();
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (job.getResult().isOK()) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (tree != null && !tree.isDisposed())
viewer.setInput(job.getRequirements());
}
});
}
}
});
job.schedule();
}
Aggregations