Package edu.umd.cs.findbugs.config

Examples of edu.umd.cs.findbugs.config.UserPreferences


    preferences.clear();
    if (loadPlugins) {
      preferences.loadPlugins(project, plugins, enabledUserPluginIds, disabledUserPluginIds, enabledBundledPluginIds, disabledBundledPluginIds, detectors);
    }

    final UserPreferences userPrefs = UserPreferences.createDefaultUserPreferences();
    final ProjectFilterSettings filterSettings = userPrefs.getFilterSettings();
    preferences.setUserPreferences(userPrefs);
    preferences.setProperty(FindBugsPreferences.RUN_ANALYSIS_IN_BACKGROUND, false);
    //_preferences.setProperty(FindBugsPreferences.ANALYSIS_EFFORT_LEVEL, AnalysisEffort.valueOfLevel(AnalysisEffort.DEFAULT.getMessage()).getEffortLevel());
    preferences.setProperty(FindBugsPreferences.ANALYSIS_EFFORT_LEVEL, userPrefs.getEffort());
    //_preferences.setProperty(FindBugsPreferences.MIN_PRIORITY_TO_REPORT, ReportConfiguration.DEFAULT_PRIORITY);
    preferences.setProperty(FindBugsPreferences.MIN_PRIORITY_TO_REPORT, filterSettings.getMinPriority());
    preferences.setProperty(FindBugsPreferences.SHOW_HIDDEN_DETECTORS, false);
    preferences.setProperty(FindBugsPreferences.TOOLWINDOW_TO_FRONT, true);
    preferences.setProperty(FindBugsPreferences.ANALYZE_AFTER_COMPILE, false);
View Full Code Here


            StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator);
            while (tok.hasMoreTokens()) {
                project.addSourceDir(new File(tok.nextToken()).getAbsolutePath());
            }
        } else if(option.equals("-userPrefs")){
            UserPreferences prefs = UserPreferences.createDefaultUserPreferences();
            prefs.read(new FileInputStream(argument));
            project.setConfiguration(prefs);
        } else {
            super.handleOptionWithArgument(option, argument);
        }
    }
View Full Code Here

        bugReporter = new BugCollectionBugReporter(project);
        bugReporter.setPriorityThreshold(Priorities.LOW_PRIORITY);
        bugReporter.setRankThreshold(BugRanker.VISIBLE_RANK_MAX);

        engine.setBugReporter(this.bugReporter);
        UserPreferences preferences = UserPreferences.createDefaultUserPreferences();
        for (String factory : enabledDetectors) {
            DetectorFactory detFactory = detectorFactoryCollection.getFactory(factory);
            preferences.enableDetector(detFactory, true);
        }
        preferences.getFilterSettings().clearAllCategories();
        this.engine.setUserPreferences(preferences);

        for (String s : analyzeMe) {
            project.addFile(getFindbugsTestCasesFile(s).getPath());
            if(s.indexOf("Eclipse") >= 0){
View Full Code Here

        }
        customDetectorsInitialized = true;
        DetectorValidator validator = new DetectorValidator();
        final SortedSet<String> detectorPaths = new TreeSet<String>();
        SortedMap<String, String> contributedDetectors = DetectorsExtensionHelper.getContributedDetectors();
        UserPreferences corePreferences = getCorePreferences(null, false);
        detectorPaths.addAll(corePreferences.getCustomPlugins(true));
        if(DEBUG) {
            dumpClassLoader(FindbugsPlugin.class);
            dumpClassLoader(Plugin.class);
            System.out.println("applyCustomDetectors - going to add " + detectorPaths.size() + " plugin urls...");
            for (String url : detectorPaths) {
                System.out.println("\t" + url);
            }
        }

        // disable custom plugins configured via properties, if they are already loaded
        Set<String> disabledPlugins = corePreferences.getCustomPlugins(false);
        Map<URI, Plugin> allPlugins = Plugin.getAllPluginsMap();
        for (Entry<URI, Plugin> entry : allPlugins.entrySet()) {
            Plugin fbPlugin = entry.getValue();
            String pluginId = fbPlugin.getPluginId();
            // ignore all custom plugins with the same plugin id as already loaded
View Full Code Here

    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) {
            fbProject.setCloudId(cloudId);
        }
        cacheBugCollectionAndProject(project, bugCollection, fbProject);
        return bugCollection;
View Full Code Here

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

     * @return current project preferences, independently if project preferences
     *         are enabled or disabled for given project.
     */
    public static UserPreferences getProjectPreferences(IProject project, boolean forceRead) {
        try {
            UserPreferences prefs = (UserPreferences) project.getSessionProperty(SESSION_PROPERTY_USERPREFS);
            if (prefs == null || forceRead) {
                prefs = readUserPreferences(project);
                if (prefs == null) {
                    prefs = getWorkspacePreferences().clone();
                }
View Full Code Here

        }
    }

    private static UserPreferences getWorkspacePreferences() {
        // create initially default settings
        UserPreferences userPrefs = FindBugsPreferenceInitializer.createDefaultUserPreferences();
        File prefsFile = WORKSPACE_PREFS_PATH.toFile();
        if (!prefsFile.isFile()) {
            return userPrefs;
        }
        // load custom settings over defaults
        FileInputStream in;
        try {
            in = new FileInputStream(prefsFile);
            userPrefs.read(in);
        } catch (IOException e) {
            FindbugsPlugin.getDefault().logException(e, "Error reading custom FindBugs preferences for workspace");
        }
        return userPrefs;
    }
View Full Code Here

        }
        try {
            // force is preventing us for out-of-sync exception if file was
            // changed externally
            InputStream in = userPrefsFile.getContents(true);
            UserPreferences userPrefs = FindBugsPreferenceInitializer.createDefaultUserPreferences();
            userPrefs.read(in);
            return userPrefs;
        } catch (IOException e) {
            FindbugsPlugin.getDefault().logException(e, "Could not read user preferences for project");
            return null;
        }
View Full Code Here

      final MavenPluginWrapper mavenPluginWrapper) throws CoreException {
    log.debug("entering handleProjectConfigurationChange");
    final MavenPluginConfigurationTranslator mavenFindbugsConfig = MavenPluginConfigurationTranslator
        .newInstance(this, session,
            mavenPluginWrapper, project);
    UserPreferences prefs;
    try {
      final List<MojoExecution> mojoExecutions = mavenPluginWrapper.getMojoExecutions();
      if (mojoExecutions.size() != 1) {
        log.error("Wrong number of executions. Expected 1. Found " + mojoExecutions.size());
        return;
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.config.UserPreferences

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.