Search in sources :

Example 1 with BndFileCapReqLoader

use of bndtools.tasks.BndFileCapReqLoader 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();
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) AnalyseBundleResolutionJob(bndtools.tasks.AnalyseBundleResolutionJob) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) BndFileCapReqLoader(bndtools.tasks.BndFileCapReqLoader) Display(org.eclipse.swt.widgets.Display)

Aggregations

AnalyseBundleResolutionJob (bndtools.tasks.AnalyseBundleResolutionJob)1 BndFileCapReqLoader (bndtools.tasks.BndFileCapReqLoader)1 IFile (org.eclipse.core.resources.IFile)1 IPath (org.eclipse.core.runtime.IPath)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)1 Display (org.eclipse.swt.widgets.Display)1