Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.SortedBugCollection


        if (args.length > 1 || (args.length > 0 && "-help".equals(args[0]))) {
            System.err.println("Usage: " + FileBugHash.class.getName() + " [<infile>]");
            System.exit(1);
        }
        BugCollection origCollection = new SortedBugCollection();
        int argCount = 0;
        if (argCount == args.length) {
            origCollection.readXML(System.in);
        } else {
            origCollection.readXML(args[argCount]);
        }
        FileBugHash result = compute(origCollection);
        for (String sourceFile : result.getSourceFiles()) {
            System.out.println(result.getHash(sourceFile) + "\t" + sourceFile);
        }
View Full Code Here


            BugGroup group = (BugGroup) element;
            String cloudName = null;
            if (group.getType() == GroupType.Project) {
                IProject project = (IProject) group.getData();
                try {
                    SortedBugCollection bc = FindbugsPlugin.getBugCollection(project, null);
                    Cloud cloud = bc.getCloud();
                    if (cloud.isOnlineCloud()) {
                        cloudName = cloud.getCloudName();
                    }
                } catch (CoreException e) {
                    FindbugsPlugin.getDefault().logException(e, "Failed to load bug collection");
View Full Code Here

     * @return the stored BugCollection, never null
     * @throws CoreException
     */
    public static SortedBugCollection getBugCollection(IProject project, IProgressMonitor monitor, boolean useCloud)
            throws CoreException {
        SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
        if (bugCollection == null) {
            try {
                readBugCollectionAndProject(project, monitor, useCloud);
                bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
            } catch (IOException e) {
View Full Code Here

        project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugCollection);
        markBugCollectionDirty(project, false);
    }

    private static SortedBugCollection createDefaultEmptyBugCollection(IProject project) throws CoreException {
        SortedBugCollection bugCollection = new SortedBugCollection();
        Project fbProject = bugCollection.getProject();

        UserPreferences userPrefs = getUserPreferences(project);

        String cloudId = userPrefs.getCloudId();
        if (cloudId != null) {
View Full Code Here

     * @throws DocumentException
     * @throws CoreException
     */
    private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor, boolean useCloud)
            throws IOException, DocumentException, CoreException {
        SortedBugCollection bugCollection;

        IPath bugCollectionPath = getBugCollectionFile(project);
        // Don't turn the path to an IFile because it isn't local to the
        // project.
        // see the javadoc for org.eclipse.core.runtime.Plugin
        File bugCollectionFile = bugCollectionPath.toFile();
        if (!bugCollectionFile.exists()) {
            // throw new
            // FileNotFoundException(bugCollectionFile.getLocation().toOSString());
            getDefault().logInfo("creating new bug collection: " + bugCollectionPath.toOSString());
            createDefaultEmptyBugCollection(project); // since we no longer
            // throw, have to do this
            // here
            return;
        }

        UserPreferences prefs = getUserPreferences(project);
        bugCollection = new SortedBugCollection();
        bugCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
        bugCollection.setDoNotUseCloud(!useCloud);

        bugCollection.readXML(bugCollectionFile);
        if (useCloud) {
            String cloudId = prefs.getCloudId();
            if (cloudId != null) {
                bugCollection.getProject().setCloudId(cloudId);
            }
        }

        cacheBugCollectionAndProject(project, bugCollection, bugCollection.getProject());
    }
View Full Code Here

     *            a progress monitor
     * @throws CoreException
     */
    public static void saveCurrentBugCollection(IProject project, IProgressMonitor monitor) throws CoreException {
        if (isBugCollectionDirty(project)) {
            SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);

            if (bugCollection != null) {
                writeBugCollection(project, bugCollection, monitor);
            }
        }
View Full Code Here

        reportExtraData(data);
    }

    @SuppressWarnings("boxing")
    private void reportExtraData(AnalysisData data) {
        SortedBugCollection bugCollection = reporter.getBugCollection();
        if(bugCollection == null) {
            return;
        }
        if (FindBugsConsole.getConsole() == null) {
            return;
        }
        IOConsoleOutputStream out = FindBugsConsole.getConsole().newOutputStream();
        PrintWriter pw = new PrintWriter(out);

        ProjectStats stats = bugCollection.getProjectStats();
        Footprint footprint = new Footprint(stats.getBaseFootprint());
        Profiler profiler = stats.getProfiler();
        Profile profile = profiler.getProfile(ClassDataAnalysisEngine.class);
        long totalClassReadTime = TimeUnit.MILLISECONDS.convert(profile.getTotalTime(), TimeUnit.NANOSECONDS);
        long totalTime = TimeUnit.MILLISECONDS.convert(footprint.getClockTime(), TimeUnit.MILLISECONDS);
View Full Code Here

                // 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);
            }
View Full Code Here

    private String getCloudId() {
        final IProject eclipseProj = getProject();
        String cloudid = null;
        if (eclipseProj != null) {
            SortedBugCollection collection = FindbugsPlugin.getBugCollectionIfSet(eclipseProj);
            if (collection != null) {
                Cloud cloud = collection.getCloud();
                if (!(cloud instanceof DoNothingCloud)) {
                    cloudid = cloud.getPlugin().getId();
                }
            }
        }
View Full Code Here

        if (eclipseProj != null) {
            CloudPlugin item = clouds.get(cloudCombo.getSelectionIndex());
            if (item != null) {
                currentUserPreferences.setCloudId(item.getId());

                SortedBugCollection collection = FindbugsPlugin.getBugCollectionIfSet(eclipseProj);
                if (collection != null) {
                    Project fbProject = collection.getProject();
                    if (fbProject != null && !item.getId().equals(fbProject.getCloudId())) {
                        fbProject.setCloudId(item.getId());
                        collection.reinitializeCloud();
                        IWorkbenchPage page = FindbugsPlugin.getActiveWorkbenchWindow().getActivePage();
                        if (page != null) {
                            IViewPart view = page.findView(FindbugsPlugin.TREE_VIEW_ID);
                            if (view instanceof CommonNavigator) {
                                CommonNavigator nav = ((CommonNavigator) view);
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.SortedBugCollection

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.