Package de.tobject.findbugs

Examples of de.tobject.findbugs.FindBugsJob


     *            The selected project.
     * @param fileName
     *            The file name to store the XML to.
     */
    private void work(final IProject project, final String fileName) {
        FindBugsJob runFindBugs = new FindBugsJob("Saving FindBugs XML data to " + fileName + "...", project) {
            @Override
            protected void runWithProgress(IProgressMonitor monitor) throws CoreException {
                BugCollection bugCollection = FindbugsPlugin.getBugCollection(project, monitor);
                try {
                    bugCollection.writeXML(fileName);
                } catch (IOException e) {
                    CoreException ex = new CoreException(FindbugsPlugin.createErrorStatus(
                            "Can't write FindBugs bug collection from project " + project + " to file " + fileName, e));
                    throw ex;
                }
            }
        };
        runFindBugs.scheduleInteractive();
    }
View Full Code Here


     * @param monitor
     */
    protected void work(final IResource resource, final List<WorkItem> resources, IProgressMonitor monitor) {
        IPreferenceStore store = FindbugsPlugin.getPluginPreferences(getProject());
        boolean runAsJob = store.getBoolean(FindBugsConstants.KEY_RUN_ANALYSIS_AS_EXTRA_JOB);
        FindBugsJob fbJob = new StartedFromBuilderJob("Finding bugs in " + resource.getName() + "...", resource, resources);
        if(runAsJob) {
            // run asynchronously, so there might be more similar jobs waiting to run
            FindBugsJob.cancelSimilarJobs(fbJob);
            fbJob.scheduleAsSystem();
        } else {
            // run synchronously (in same thread)
            fbJob.run(monitor);
        }
    }
View Full Code Here

     * @param javaProject
     *            the project
     */
    public static void redisplayMarkers(final IJavaProject javaProject) {
        final IProject project = javaProject.getProject();
        FindBugsJob job = new FindBugsJob("Refreshing FindBugs markers", project) {
            @Override
            protected void runWithProgress(IProgressMonitor monitor) throws CoreException {
                // TODO in case we removed some of previously available
                // detectors, we should
                // throw away bugs reported by them

                // Get the saved bug collection for the project
                SortedBugCollection bugs = FindbugsPlugin.getBugCollection(project, monitor);
                // Remove old markers
                project.deleteMarkers(FindBugsMarker.NAME, true, IResource.DEPTH_INFINITE);
                // Display warnings
                createMarkers(javaProject, bugs, project, monitor);
            }
        };
        job.scheduleInteractive();
    }
View Full Code Here

     *
     * @param project
     *            The resource to load XMl to.
     */
    private void work(final IProject project, final String fileName) {
        FindBugsJob runFindBugs = new FindBugsJob("Loading XML data from " + fileName + "...", project) {
            @Override
            protected void runWithProgress(IProgressMonitor monitor) throws CoreException {
                FindBugsWorker worker = new FindBugsWorker(project, monitor);
                worker.loadXml(fileName);
            }
        };
        runFindBugs.scheduleInteractive();
    }
View Full Code Here

     *
     * @param resources
     *            The resource to run the analysis on.
     */
    protected void work(IWorkbenchPart part, final IResource resource, final List<WorkItem> resources) {
        FindBugsJob runFindBugs = new StartedFromViewJob("Finding bugs in " + resource.getName() + "...", resource, resources, part);
        runFindBugs.scheduleInteractive();
    }
View Full Code Here

     * Clear the FindBugs markers on each project in the given selection,
     * displaying a progress monitor.
     */
    @Override
    protected void work(final IWorkbenchPart part, IResource resource, final List<WorkItem> resources) {
        FindBugsJob clearMarkersJob = new ClearMarkersJob(resource, resources);
        clearMarkersJob.addJobChangeListener(new JobChangeAdapter() {
            @Override
            public void done(IJobChangeEvent event) {
                refreshViewer(part, resources);
            }
        });
        clearMarkersJob.scheduleInteractive();
    }
View Full Code Here

TOP

Related Classes of de.tobject.findbugs.FindBugsJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.