Package edu.umd.cs.findbugs.filter

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


        for (Map.Entry<JCheckBox, Sortables> e : map.entrySet()) {
            if (e.getKey().isSelected()) {
                set.add(e.getValue());
            }
        }
        Matcher matcher = null;
        if (!set.isEmpty()) {
            matcher = FilterFactory.makeMatcher(set, bug);

            if(notFilterCheck.isSelected()) {
                matcher = FilterFactory.invertMatcher(matcher);
View Full Code Here


                            // let this be
                            // 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,
View Full Code Here

        JButton okButton = new JButton(edu.umd.cs.findbugs.L10N.getLocalString("dlg.ok_btn", "OK"));

        okButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                Matcher matcherFromSelection = filterFromBugPicker.makeMatcherFromSelection();
                applyNewFilter.fromMatcher(matcherFromSelection);
                closeDialog();
            }
        });
        JButton cancelButton = new JButton(edu.umd.cs.findbugs.L10N.getLocalString("dlg.cancel_btn", "Cancel"));
View Full Code Here

public class FilterFactoryTest {

    @Test
    public void invertMatcherShouldNegateTheOriginalMatchingResult() {
        BugInstance bug = new BugInstance("UUF_UNUSED_FIELD", 0);
        Matcher originalMatcher = FilterFactory.makeMatcher(asList(Sortables.BUGCODE), bug);

        assertTrue("Original matcher should match bug.", originalMatcher.match(bug));

        Matcher notMatcher = FilterFactory.invertMatcher(originalMatcher);
        assertTrue("Should return an instance of NotMatcher.", notMatcher instanceof NotMatcher);
        assertFalse("Inverted matcher should now not match.", notMatcher.match(bug));
    }
View Full Code Here

    }

    @Test
    public void shouldReturnTheOriginalMatcherWhenAskedToInvertANotMatcher() {
        BugInstance bug = new BugInstance("UUF_UNUSED_FIELD", 0);
        Matcher originalMatcher = FilterFactory.makeMatcher(asList(Sortables.BUGCODE), bug);
        Matcher notMatcher = FilterFactory.invertMatcher(originalMatcher);
        Matcher notNotMatcher = FilterFactory.invertMatcher(notMatcher);

        assertSame("Should return the originally wrapped matcher.", originalMatcher, notNotMatcher);
        assertTrue("Original matcher should now not match.", notNotMatcher.match(bug));
    }
View Full Code Here

TOP

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

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.