Merge remote-tracking branch 'origin/GP-4336-dragonmacher-vt-fitler-exception' into patch

This commit is contained in:
Ryan Kurtz
2024-02-20 07:39:33 -05:00

View File

@@ -15,8 +15,7 @@
*/ */
package ghidra.feature.vt.gui.filters; package ghidra.feature.vt.gui.filters;
import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.APPLIED; import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.*;
import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.NONE;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.*; import java.util.*;
@@ -62,6 +61,11 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
initializeTags(); initializeTags();
} }
@Override
protected Filter<VTMatch> createEmptyCopy() {
return new TagFilter(controller);
}
private JComponent createComponent() { private JComponent createComponent() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createTitledBorder("Tags")); panel.setBorder(BorderFactory.createTitledBorder("Tags"));
@@ -95,7 +99,7 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
} }
/** /**
* This differs from {@link #initializeTags()} in that this method will keep any excluded * This differs from {@link #initializeTags()} in that this method will keep any excluded
* tags when updating. * tags when updating.
*/ */
private void reInitializeTags() { private void reInitializeTags() {
@@ -290,11 +294,11 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
Set<String> names = excludedTags.keySet(); Set<String> names = excludedTags.keySet();
Set<String> otherNames = otherTagFilter.excludedTags.keySet(); Set<String> otherNames = otherTagFilter.excludedTags.keySet();
// //
// This filter is a collection of 'things', that are NOT allowed to pass the filter. // This filter is a collection of 'things', that are NOT allowed to pass the filter.
// We are only a sub-filter if the other filter is a subset of our filter, since we will // We are only a sub-filter if the other filter is a subset of our filter, since we will
// be taking the already excluded items and adding more restrictions. Suppose our filter // be taking the already excluded items and adding more restrictions. Suppose our filter
// consists of: 'cat', 'dog', 'mouse'. We would then be a sub-filter if the other // consists of: 'cat', 'dog', 'mouse'. We would then be a sub-filter if the other
// filter's set consists of: 'cat', 'dog'. // filter's set consists of: 'cat', 'dog'.
// //
if (names.containsAll(otherNames)) { if (names.containsAll(otherNames)) {
@@ -345,10 +349,10 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
public void sessionUpdated(DomainObjectChangedEvent ev) { public void sessionUpdated(DomainObjectChangedEvent ev) {
// //
// Note: we don't trigger a refilter after changes are made. We assume that if a tag // Note: we don't trigger a refilter after changes are made. We assume that if a tag
// is added, then it will not be excluded by default. If a tag is removed, // is added, then it will not be excluded by default. If a tag is removed,
// then the work to remove it will have cleared any matches using that tag, which // then the work to remove it will have cleared any matches using that tag, which
// will trigger an update to the table, which will trigger a refilter. // will trigger an update to the table, which will trigger a refilter.
// //
for (int i = 0; i < ev.numRecords(); i++) { for (int i = 0; i < ev.numRecords(); i++) {
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i); DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);