Package edu.umd.cs.findbugs.filter

Examples of edu.umd.cs.findbugs.filter.Filter


     * @throws java.io.IOException
     * @throws edu.umd.cs.findbugs.filter.FilterException
     */
    public static BugReporter configureFilter(BugReporter bugReporter, String filterFileName, boolean include)
            throws IOException, FilterException {
        Filter filter = new Filter(filterFileName);
        return new FilterBugReporter(bugReporter, filter, include);

    }
View Full Code Here


    }

    //    @SuppressWarnings({ "SimplifiableIfStatement" })
    boolean shouldDisplayIssue(BugInstance b) {
        Project project = getProject();
        Filter suppressionFilter = project.getSuppressionFilter();
        if (null == getBugCollection() || suppressionFilter.match(b)) {
            return false;
        }
        return viewFilter.show(b);
    }
View Full Code Here

    }

    //    @SuppressWarnings({ "SimplifiableIfStatement" })
    private boolean shouldDisplayIssueIgnoringPackagePrefixes(BugInstance b) {
        Project project = getProject();
        Filter suppressionFilter = project.getSuppressionFilter();
        if (null == getBugCollection() || suppressionFilter.match(b)) {
            return false;
        }
        return viewFilter.showIgnoringPackagePrefixes(b);
    }
View Full Code Here

    static void addDeadBugMatcher(BugCollection bugCollection) {
        if (bugCollection == null  || !bugCollection.hasDeadBugs()) {
            return;
        }

        Filter suppressionMatcher = bugCollection.getProject().getSuppressionFilter();
        suppressionMatcher.softAdd(LastVersionMatcher.DEAD_BUG_MATCHER);
    }
View Full Code Here

            if (!f.exists()) {
                JOptionPane.showMessageDialog(filterOpenFileChooser, "No such file", "Invalid File", JOptionPane.WARNING_MESSAGE);
                retry = true;
                continue;
            }
            Filter filter;
            try {
                filter = Filter.parseFilter(f.getPath());
            } catch (IOException e) {
                JOptionPane.showMessageDialog(filterOpenFileChooser, "Could not load filter.");
                retry = true;
                continue;
            }
            mainFrame.setProjectChanged(true);
            Filter suppressionFilter = mainFrame.getProject().getSuppressionFilter();

            for (Matcher m : filter.getChildren()) {
                suppressionFilter.addChild(m);
            }

            PreferencesFrame.getInstance().updateFilterPanel();
        }
View Full Code Here

                    continue;
                }

            }

            Filter suppressionFilter = mainFrame.getProject().getSuppressionFilter();
            try {
                suppressionFilter.writeEnabledMatchersAsXML(new FileOutputStream(f));
            } catch (IOException e) {
                JOptionPane.showMessageDialog(mainFrame,
                        L10N.getLocalString("dlg.saving_error_lbl", "An error occurred in saving."));
                return false;
            }
View Full Code Here

                            // removed,
                            // rebuild tree
                            // from root.
                        {
                            Matcher m = mainFrame.getCurrentSelectedBugAspects().getMatcher();
                            Filter suppressionFilter = MainFrame.getInstance().getProject().getSuppressionFilter();
                            suppressionFilter.addChild(m);
                            PreferencesFrame.getInstance().updateFilterPanel();
                            FilterActivity.notifyListeners(FilterListener.Action.FILTERING, null);
                            return;
                        }
                        count = ((BugAspects) (deletePath.getParentPath().getLastPathComponent())).getCount();
                    }
                    /*
                     * deletePath should now be a path to the highest ancestor
                     * branch with the same number of elements as the branch to
                     * be deleted in other words, the branch that we actually
                     * have to remove in order to correctly remove the selected
                     * branch.
                     */
                    BugTreeModel model = MainFrame.getInstance().getBugTreeModel();
                    TreeModelEvent event = new TreeModelEvent(mainFrame, deletePath.getParentPath(),
                            new int[] { model.getIndexOfChild(deletePath.getParentPath().getLastPathComponent(),
                                    deletePath.getLastPathComponent()) }, new Object[] { deletePath.getLastPathComponent() });
                    Matcher m = mainFrame.getCurrentSelectedBugAspects().getMatcher();
                    Filter suppressionFilter = MainFrame.getInstance().getProject().getSuppressionFilter();
                    suppressionFilter.addChild(m);
                    PreferencesFrame.getInstance().updateFilterPanel();
                    model.sendEvent(event, BugTreeModel.TreeModification.REMOVE);
                    // FilterActivity.notifyListeners(FilterListener.Action.FILTERING,
                    // null);

View Full Code Here

                // Set release name, if present.
                String releaseName = getOptionalAttribute(attributes, "release");
                bugCollection.setReleaseName((releaseName != null) ? releaseName : "");
            } else if (isTopLevelFilter(qName)) {
                if (project != null) {
                    filter = new Filter();
                    project.setSuppressionFilter(filter);
                }
                matcherStack.clear();
                pushCompoundMatcher(filter);
            } else if (qName.equals(PROJECT)) {
View Full Code Here

        filterPanel.add(removeAllButton, gbc);
        removeAllButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                boolean needsRebuild = false;
                Filter suppressionFilter = MainFrame.getInstance().getProject().getSuppressionFilter();
                if (!suppressionFilter.isEmpty()) {
                    needsRebuild = true;
                }
                suppressionFilter.clear();

                if (needsRebuild) {
                    // filters being cleared were disabled
                    FilterActivity.notifyListeners(FilterListener.Action.UNFILTERING, null);
                }
View Full Code Here

        }
    }

    void updateFilterPanel() {
        ArrayList<MatchBox> boxes = new ArrayList<MatchBox>();
        final Filter f = MainFrame.getInstance().getProject().getSuppressionFilter();

        for (final Matcher m : f.getChildren()) {
            MatchBox box = new MatchBox(m.toString(), m);
            box.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent evt) {
                    boolean isSelected = ((JCheckBox) evt.getSource()).isSelected();
                    boolean wasSelected = f.isEnabled(m);
                    if (isSelected == wasSelected) {
                        return;
                    }
                    f.setEnabled(m, isSelected);
                    updateFilters(isSelected);

                }
            });
            box.setSelected(f.isEnabled(m));
            boxes.add(box);
        }

        filterCheckBoxList.setListData(boxes.toArray(new MatchBox[boxes.size()]));
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.filter.Filter

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.