if (element instanceof IJavaProject) { IJavaProject javaProject = (IJavaProject) element; final IProject project = javaProject.getProject(); AbstractFilesCollector collector = FilesCollectorFactory.getFilesCollector(project); try { final Collection files = collector.getFiles();  IRunnableWithProgress r = new IRunnableWithProgress() { public void run(IProgressMonitor pm) throws InvocationTargetException { try { FindBugsWorker worker = new FindBugsWorker(project, pm); worker.work(files); } catch (CoreException ex) { throw new InvocationTargetException(ex); } } };  ProgressMonitorDialog progress = new ProgressMonitorDialog(FindbugsPlugin.getShell()); progress.run(true, true, r); } catch (CoreException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); }
IProject project = getProject(element); if (project != null) { work(project);
	public final void run(final IAction action) {		if (!selection.isEmpty()) {			if (selection instanceof IStructuredSelection) {				IStructuredSelection structuredSelection = (IStructuredSelection) selection;				for (Iterator iter = structuredSelection.iterator(); iter.hasNext(); ) {					Object element = (Object) iter.next();					/* If the current selection is a Java project:					 * - get all contained files					 * - hand them over to a FindBugs worker for processing 					 */					if (element instanceof IJavaProject) {						IJavaProject javaProject = (IJavaProject) element;						final IProject project = javaProject.getProject();						AbstractFilesCollector collector = FilesCollectorFactory.getFilesCollector(project);						try {							final Collection files = collector.getFiles();							IRunnableWithProgress r = new IRunnableWithProgress() {								public void run(IProgressMonitor pm) throws InvocationTargetException {									try {										FindBugsWorker worker = new FindBugsWorker(project, pm);										worker.work(files);									}									catch (CoreException ex) {										throw new InvocationTargetException(ex);									}								}							};							ProgressMonitorDialog progress = new ProgressMonitorDialog(FindbugsPlugin.getShell());							progress.run(true, true, r);						}						catch (CoreException e) {							e.printStackTrace();						}						catch (InvocationTargetException e) {							e.printStackTrace();						}						catch (InterruptedException e) {							e.printStackTrace();						}					}				}			}		}	}