Examples of FindBugsPreferences


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

  @SuppressWarnings("ConstantConditions")
  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

    registerEventListener(project);

    // toggle value
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
      final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
      final String groupByProperty = preferences.getProperty(FindBugsPreferences.TOOLWINDOW_GROUP_BY, GroupBy.BugCategory.name());

      final boolean equals = GroupBy.BugCategory.name().equals(groupByProperty);
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final GroupBy[] sortOrderGroup = GroupBy.getSortOrderGroup(GroupBy.BugCategory);
      if(equals && !Arrays.equals(panel.getBugTreePanel().getGroupBy(), sortOrderGroup)) {
View Full Code Here

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

    // toggle value
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
      if (selected) {
        preferences.setProperty(FindBugsPreferences.TOOLWINDOW_GROUP_BY, GroupBy.BugCategory.name());
        panel.getBugTreePanel().setGroupBy(GroupBy.getSortOrderGroup(GroupBy.BugCategory));
      }
    }
  }
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

    //userPrefs.enableAllDetectors(true);

    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

    registerEventListener(project);

    // toggle value
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
      final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
      final String groupByProperty = preferences.getProperty(FindBugsPreferences.TOOLWINDOW_GROUP_BY, GroupBy.BugCategory.name());

      final boolean equals = GroupBy.Class.name().equals(groupByProperty);
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final GroupBy[] sortOrderGroup = GroupBy.getSortOrderGroup(GroupBy.Class);
      if(equals && !Arrays.equals(panel.getBugTreePanel().getGroupBy(), sortOrderGroup)) {
View Full Code Here

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

    // toggle value
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
      if (selected) {
        preferences.setProperty(FindBugsPreferences.TOOLWINDOW_GROUP_BY, GroupBy.Class.name());
        panel.getBugTreePanel().setGroupBy(GroupBy.getSortOrderGroup(GroupBy.Class));
      }
    }
  }
View Full Code Here

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

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

    final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
    String exportDir = preferences.getProperty(FindBugsPreferences.EXPORT_BASE_DIR, FindBugsPluginConstants.DEFAULT_EXPORT_DIR);
    boolean exportXml = preferences.getBooleanProperty(FindBugsPreferences.EXPORT_AS_XML, true);
    boolean exportHtml = preferences.getBooleanProperty(FindBugsPreferences.EXPORT_AS_HTML, true);
    boolean exportBoth = exportXml && preferences.getBooleanProperty(FindBugsPreferences.EXPORT_AS_HTML, true);

    if (exportDir.isEmpty() || !exportXml && !exportBoth && !exportHtml) {

      //Ask the user for a export directory
      final DialogBuilder dialogBuilder = new DialogBuilder(project);
      dialogBuilder.addOkAction();
      dialogBuilder.addCancelAction();
      dialogBuilder.setTitle("Select directory to save the exported file");
      final ExportFileDialog exportDialog = new ExportFileDialog(exportDir, dialogBuilder);
      dialogBuilder.showModal(true);
      if (dialogBuilder.getDialogWrapper().getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
        return;
      }
      final String path = exportDialog.getText();
      if (path == null || path.trim().isEmpty()) {
        return;
      }

      exportXml = exportDialog.isXml() != exportXml ? exportDialog.isXml() : exportXml;
      exportHtml = exportDialog.isXml() == exportHtml ? !exportDialog.isXml() : exportHtml;
      exportBoth = exportDialog.isBoth() != exportBoth ? exportDialog.isBoth() : exportBoth;
      exportDir = path.trim();
    }
    //Create a unique file name by using time stamp
    final Date currentDate = new Date();
    final String timestamp = PATTERN.matcher(new SimpleDateFormat().format(currentDate)).replaceAll("_");
    final String fileName = File.separatorChar + FINDBUGS_RESULT_PREFIX + timestamp;

    final boolean finalExportXml = exportXml;
    final boolean finalExportHtml = exportHtml;
    final boolean finalExportBoth = exportBoth;
    final String finalExportDir = exportDir + File.separatorChar + project.getName();

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


      @edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"REC_CATCH_EXCEPTION"})
      @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"})
      @Override
      public void run(@NotNull final ProgressIndicator indicator) {
        indicator.setText2(finalExportDir + File.separatorChar + fileName);
        setProgressIndicator(indicator);
        Writer writer = null;
        try {
          createDirIfAbsent(project, finalExportDir);
          String exportDir = finalExportDir;
          final boolean createSubDir = preferences.getBooleanProperty(FindBugsPreferences.EXPORT_CREATE_ARCHIVE_DIR, true);
          if(createSubDir) {
            exportDir = finalExportDir + File.separatorChar + new SimpleDateFormat("yyyy_MM_dd", Locale.ENGLISH).format(currentDate);
            createDirIfAbsent(project, exportDir);
          }

          if (_bugCollection != null) {
            _bugCollection.setWithMessages(true);
            final String exportDirAndFilenameWithoutSuffix = exportDir + fileName;
            if (finalExportXml && !finalExportBoth) {
              exportXml(exportDirAndFilenameWithoutSuffix + FINDBUGS_RESULT_RAW_SUFFIX);
            } else if (finalExportBoth) {
              exportXml(exportDirAndFilenameWithoutSuffix + FINDBUGS_RESULT_RAW_SUFFIX);
              writer = exportHtml(exportDirAndFilenameWithoutSuffix + FINDBUGS_RESULT_HTML_SUFFIX);
            } else if (finalExportHtml) {
              writer = exportHtml(exportDirAndFilenameWithoutSuffix + FINDBUGS_RESULT_HTML_SUFFIX);
            }
            _bugCollection.setWithMessages(false);

            showToolWindowNotifier(project, "Exported bug collection to " + exportDir + '.', MessageType.INFO);
            if((!finalExportXml || finalExportBoth) && preferences.getBooleanProperty(FindBugsPreferences.EXPORT_OPEN_BROWSER, true)) {
              BrowserUtil.launchBrowser(new File(exportDirAndFilenameWithoutSuffix + FINDBUGS_RESULT_HTML_SUFFIX).getAbsolutePath());
            }
          }
        } catch (final IOException e1) {
          final String message = "Export failed";
View Full Code Here

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

    registerEventListener(project);

    // toggle value
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
      final FindBugsPreferences preferences = getPluginInterface(project).getPreferences();
      final String groupByProperty = preferences.getProperty(FindBugsPreferences.TOOLWINDOW_GROUP_BY, GroupBy.BugCategory.name());

      final boolean equals = GroupBy.Package.name().equals(groupByProperty);
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final GroupBy[] sortOrderGroup = GroupBy.getSortOrderGroup(GroupBy.Package);
      if(equals && !Arrays.equals(panel.getBugTreePanel().getGroupBy(), sortOrderGroup)) {
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.