Examples of FindBugsPreferences


Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    final DialogBuilder dialogBuilder = new DialogBuilder(project);
    dialogBuilder.addOkAction();
    dialogBuilder.addCancelAction();
    dialogBuilder.setTitle("Import previous saved bug collection xml");

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    final String exportDir = preferences.getProperty(FindBugsPreferences.EXPORT_BASE_DIR, FindBugsPluginConstants.DEFAULT_EXPORT_DIR) + File.separatorChar + project.getName();

    final ImportFileDialog importFileDialog = new ImportFileDialog(exportDir, dialogBuilder);
    dialogBuilder.showModal(true);
    if (dialogBuilder.getDialogWrapper().getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
      return;
    }
    final String fileToImport = importFileDialog.getText();
    if (fileToImport == null || fileToImport.trim().isEmpty()) {
      return;
    }


    final FindBugsPlugin findBugsPlugin = getPluginInterface(project);
    final BugCollection bugCollection = findBugsPlugin.getToolWindowPanel().getBugCollection();
    if (bugCollection != null && !bugCollection.getCollection().isEmpty()) {
      //noinspection DialogTitleCapitalization
      final int result = Messages.showYesNoDialog(project, "Current result in the 'Found bugs view' will be deleted. Continue ?", "Delete found bugs?", Messages.getQuestionIcon());
      if (result == 1) {
        return;
      }
    }

    //Create a task to export the bug collection to html
    final AtomicReference<Task> importTask = new AtomicReference<Task>(new BackgroundableTask(project, "Importing Findbugs Result", true) {
      private ProgressIndicator _indicator;


      @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"})
      @Override
      public void run(@NotNull final ProgressIndicator indicator) {

        EventManagerImpl.getInstance().fireEvent(new BugReporterEventImpl(Operation.ANALYSIS_STARTED, null, 0, project.getName()));
        setProgressIndicator(indicator);
        indicator.setFraction(0.0);
        indicator.setIndeterminate(false);
        indicator.setText(fileToImport);
        try {
          _bugCollection = new SortedBugCollection();
          final FindBugsPlugin pluginComponent = IdeaUtilImpl.getPluginComponent(project);
          _importBugCollection = _bugCollection.createEmptyCollectionWithMetadata();
          final edu.umd.cs.findbugs.Project importProject = _importBugCollection.getProject();
          importProject.setGuiCallback(new PluginGuiCallback(pluginComponent));
          _importBugCollection.setDoNotUseCloud(true);
          for (final Plugin plugin : Plugin.getAllPlugins()) {
            importProject.setPluginStatusTrinary(plugin.getPluginId(), !preferences.isPluginDisabled(plugin.getPluginId()));
          }
          _importBugCollection.readXML(fileToImport);

          final ProjectStats projectStats = _importBugCollection.getProjectStats();
          int bugCount = 0;
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", getPluginInterface(project).getInternalToolWindowId());
      return;
    }

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    if (preferences.getBugCategories().containsValue("true") && preferences.getDetectors().containsValue("true")) {
      initWorker();
    } else {
      FindBugsPluginImpl.showToolWindowNotifier(project, "No bug categories or bug pattern detectors selected. analysis aborted.", MessageType.WARNING);
      ShowSettingsUtil.getInstance().editConfigurable(project, IdeaUtilImpl.getPluginComponent(project));
    }
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

  private void initWorker() {

    final com.intellij.openapi.project.Project project = IdeaUtilImpl.getProject(_dataContext);
    final Module module = IdeaUtilImpl.getModule(_dataContext);

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    if (Boolean.valueOf(preferences.getProperty(FindBugsPreferences.TOOLWINDOW_TO_FRONT))) {
      IdeaUtilImpl.activateToolWindow(getPluginInterface(project).getInternalToolWindowId(), _dataContext);
    }

    final FindBugsWorker worker = new FindBugsWorker(project, module);
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

  public SuppressReportBugIntentionAction(final ExtendedProblemDescriptor problemDescriptor) {
    _problemDescriptor = problemDescriptor;
    _bugPatternId = getBugId(problemDescriptor);

    final Project project = IdeaUtilImpl.getProject(problemDescriptor.getPsiFile());
    final FindBugsPreferences preferences = IdeaUtilImpl.getPluginComponent(project).getPreferences();
    _suppressWarningsClassName = preferences.getProperty(FindBugsPreferences.ANNOTATION_SUPPRESS_WARNING_CLASS);
  }
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    this(project, IdeaUtilImpl.getPluginComponent(project).getPreferences().getBooleanProperty(FindBugsPreferences.RUN_ANALYSIS_IN_BACKGROUND, false));
  }


  public FindBugsWorker(final com.intellij.openapi.project.Project project, final Module module) {
    final FindBugsPreferences preferences = IdeaUtilImpl.getPluginComponent(project).getPreferences();
    _startInBackground = preferences.getBooleanProperty(FindBugsPreferences.RUN_ANALYSIS_IN_BACKGROUND, false);
    _project = project;
    _module = module;

    configure();
  }
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

   *
   * @see org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences#applyDetectors()
   */
  private void configure() {

    FindBugsPreferences preferences = IdeaUtilImpl.getPluginComponent(_project).getPreferences();
    if (_module != null && preferences.isModuleConfigEnabled(_module)) {
      preferences = IdeaUtilImpl.getModuleComponent(_module).getPreferences();
    }

    //_startInBackground = preferences.getBooleanProperty(FindBugsPreferences.RUN_ANALYSIS_IN_BACKGROUND, false);

    _userPrefs = preferences.getUserPreferences();//UserPreferences.createDefaultUserPreferences();
    _userPrefs.setEffort(preferences.getProperty(FindBugsPreferences.ANALYSIS_EFFORT_LEVEL, AnalysisEffort.DEFAULT.getEffortLevel()));

    final ProjectFilterSettings projectFilterSettings = _userPrefs.getFilterSettings();
    projectFilterSettings.setMinPriority(preferences.getProperty(FindBugsPreferences.MIN_PRIORITY_TO_REPORT));

    configureSelectedCategories(preferences, projectFilterSettings);
    //_userPrefs.setFilterSettings(projectFilterSettings);

    _userPrefs.setIncludeFilterFiles(preferences.getIncludeFiltersMap());
    _userPrefs.setExcludeBugsFiles(preferences.getExcludeBaselineBugsMap());
    _userPrefs.setExcludeFilterFiles(preferences.getExcludeFiltersMap());
    //_userPrefs.setUserDetectorThreshold(preferences.getProperty(FindBugsPreferences.MIN_PRIORITY_TO_REPORT)); // todo: needed?

    _findBugsProject = new FindBugsProject();
    _findBugsProject.setProjectName(_project.getName());
    for (final Plugin plugin : Plugin.getAllPlugins()) {
      _findBugsProject.setPluginStatusTrinary(plugin.getPluginId(), !preferences.isPluginDisabled(plugin.getPluginId()));
    }

    final FindBugsPlugin pluginComponent = IdeaUtilImpl.getPluginComponent(_project);
    _findBugsProject.setGuiCallback(new PluginGuiCallback(pluginComponent));

View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", "FindBugs");
      return;
    }

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    if (preferences.getBugCategories().containsValue("true") && preferences.getDetectors().containsValue("true")) {
      initWorker();
    } else {
      FindBugsPluginImpl.showToolWindowNotifier(project, "No bug categories or bug pattern detectors selected. analysis aborted.", MessageType.WARNING);
      ShowSettingsUtil.getInstance().editConfigurable(project, IdeaUtilImpl.getPluginComponent(project));
    }
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

  private void initWorker() {
    final com.intellij.openapi.project.Project project = IdeaUtilImpl.getProject(_dataContext);
    final Module module = IdeaUtilImpl.getModule(_dataContext);

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    if (Boolean.valueOf(preferences.getProperty(FindBugsPreferences.TOOLWINDOW_TO_FRONT))) {
      IdeaUtilImpl.activateToolWindow(getPluginInterface(project).getInternalToolWindowId(), _dataContext);
    }

    final FindBugsWorker worker = new FindBugsWorker(project, module);
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    final com.intellij.openapi.project.Project project = compileContext.getProject();
    if (null == project) { // project reload, eg: open IDEA project with unknown JRE and fix it
      return;
    }
    final FindBugsPlugin findBugsPlugin = IdeaUtilImpl.getPluginComponent(project);
    final FindBugsPreferences preferences = findBugsPlugin.getPreferences();

    if (!Boolean.valueOf(preferences.getProperty(FindBugsPreferences.ANALYZE_AFTER_COMPILE))) {
      return;
    }

    final CompileScope compileScope = compileContext.getCompileScope();
    final VirtualFile[] affectedFiles = compileScope.getFiles(StdFileTypes.JAVA, true);

    if (Boolean.valueOf(preferences.getProperty(FindBugsPreferences.TOOLWINDOW_TO_FRONT))) {
      final ToolWindow toolWindow = IdeaUtilImpl.getToolWindowById(findBugsPlugin.getInternalToolWindowId(), project);
      IdeaUtilImpl.activateToolWindow(toolWindow);
    }

    final FindBugsWorker worker = new FindBugsWorker(project, true);
View Full Code Here

Examples of org.twodividedbyzero.idea.findbugs.preferences.FindBugsPreferences

    _plugin = plugin;

    initGui();

    final FindBugsPreferences preferences = getPreferences();
    if (!preferences.getBugCategories().containsValue("true") && !preferences.getDetectors().containsValue("true") || (preferences.getBugCategories().isEmpty() && preferences.getDetectors().isEmpty())) {
      restoreDefaultPreferences();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.