mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 05:55:57 +08:00
GT-3515 - Column constraint docs review fixes
This commit is contained in:
+2
-2
@@ -314,7 +314,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
|||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFitlerPanel(boolean selected) {
|
private void showFilterPanel(boolean selected) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
mainPanel.add(filterPanel, BorderLayout.SOUTH);
|
mainPanel.add(filterPanel, BorderLayout.SOUTH);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
showFitlerPanel(isSelected());
|
showFilterPanel(isSelected());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -537,7 +537,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
|
|||||||
public ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
public ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
||||||
// not sure about this: it could be USE_COLUMN_CONSTRAINTS_ONLY, but then the text
|
// not sure about this: it could be USE_COLUMN_CONSTRAINTS_ONLY, but then the text
|
||||||
// filter would not match the formatted date. This allows for both.
|
// filter would not match the formatted date. This allows for both.
|
||||||
return ColumnConstraintFilterMode.USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS;
|
return ColumnConstraintFilterMode.ALLOW_ALL_FILTERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -328,7 +328,7 @@ class VTFunctionAssociationTableModel extends AddressBasedTableModel<VTFunctionR
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasNoFilter() {
|
private boolean hasNoFilter() {
|
||||||
return filterSettings == FilterSettings.SHOW_ALL && !hasFitler();
|
return filterSettings == FilterSettings.SHOW_ALL && !hasFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean passesUnmatchedFunctionFilter(FunctionAssociationInfo info) {
|
private boolean passesUnmatchedFunctionFilter(FunctionAssociationInfo info) {
|
||||||
|
|||||||
+5
-6
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.feature.vt.gui.provider.matchtable;
|
package ghidra.feature.vt.gui.provider.matchtable;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
import ghidra.feature.vt.api.main.VTMatch;
|
import ghidra.feature.vt.api.main.VTMatch;
|
||||||
import ghidra.feature.vt.gui.filters.*;
|
import ghidra.feature.vt.gui.filters.*;
|
||||||
import ghidra.feature.vt.gui.plugin.VTController;
|
import ghidra.feature.vt.gui.plugin.VTController;
|
||||||
@@ -23,8 +24,6 @@ import ghidra.util.HelpLocation;
|
|||||||
import ghidra.util.layout.VariableRowHeightGridLayout;
|
import ghidra.util.layout.VariableRowHeightGridLayout;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class MatchesFilterDialogComponentProvider extends
|
public class MatchesFilterDialogComponentProvider extends
|
||||||
AncillaryFilterDialogComponentProvider<VTMatch> {
|
AncillaryFilterDialogComponentProvider<VTMatch> {
|
||||||
|
|
||||||
@@ -58,9 +57,9 @@ public class MatchesFilterDialogComponentProvider extends
|
|||||||
|
|
||||||
// Row 1 - Right Component
|
// Row 1 - Right Component
|
||||||
// association status filter
|
// association status filter
|
||||||
AssociationStatusFilter associationStatusFitler = new AssociationStatusFilter();
|
AssociationStatusFilter associationStatusFilter = new AssociationStatusFilter();
|
||||||
addFilter(associationStatusFitler);
|
addFilter(associationStatusFilter);
|
||||||
rowOnePanel.add(associationStatusFitler.getComponent());
|
rowOnePanel.add(associationStatusFilter.getComponent());
|
||||||
|
|
||||||
// Row 2 - Left Component
|
// Row 2 - Left Component
|
||||||
// symbol type filter
|
// symbol type filter
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ public class DefaultRowFilterTransformer<ROW_OBJECT> implements RowFilterTransfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColumnConstraintFilterMode mode = renderer.getColumnConstraintFilterMode();
|
ColumnConstraintFilterMode mode = renderer.getColumnConstraintFilterMode();
|
||||||
return mode == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY;
|
return mode == ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRenderedColumnValue(Object columnValue, int columnIndex) {
|
private String getRenderedColumnValue(Object columnValue, int columnIndex) {
|
||||||
|
|||||||
+6
-6
@@ -91,7 +91,7 @@ public class ColumnFilterData<T> implements Comparable<ColumnFilterData<T>> {
|
|||||||
// and does not support the traditional text based filtering.
|
// and does not support the traditional text based filtering.
|
||||||
//
|
//
|
||||||
ColumnConstraintFilterMode mode = columnRenderer.getColumnConstraintFilterMode();
|
ColumnConstraintFilterMode mode = columnRenderer.getColumnConstraintFilterMode();
|
||||||
if (mode == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY) {
|
if (mode == ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY) {
|
||||||
return new ArrayList<>(defaultConstraints);
|
return new ArrayList<>(defaultConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,16 +106,16 @@ public class ColumnFilterData<T> implements Comparable<ColumnFilterData<T>> {
|
|||||||
ColumnRendererMapper mapper = new ColumnRendererMapper(asT, columnBasedModel, modelIndex);
|
ColumnRendererMapper mapper = new ColumnRendererMapper(asT, columnBasedModel, modelIndex);
|
||||||
Collection<ColumnConstraint<T>> rendererStringConstraints =
|
Collection<ColumnConstraint<T>> rendererStringConstraints =
|
||||||
DiscoverableTableUtils.getColumnConstraints(mapper);
|
DiscoverableTableUtils.getColumnConstraints(mapper);
|
||||||
|
if (mode == ColumnConstraintFilterMode.ALLOW_RENDERER_STRING_FILTER_ONLY) {
|
||||||
|
return new ArrayList<>(rendererStringConstraints);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Case 5: the renderer supports both text filtering and column constraint filtering.
|
// Case 5: the renderer supports both text filtering and column constraint filtering.
|
||||||
//
|
//
|
||||||
|
// assume: mode == ColumnConstraintFilterMode.ALLOW_ALL_FILTERS
|
||||||
List<ColumnConstraint<T>> results = new ArrayList<>(rendererStringConstraints);
|
List<ColumnConstraint<T>> results = new ArrayList<>(rendererStringConstraints);
|
||||||
if (mode == ColumnConstraintFilterMode.USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS) {
|
results.addAll(defaultConstraints);
|
||||||
// also use the normal constraints with the renderer constraints
|
|
||||||
results.addAll(defaultConstraints);
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ public class ColumnFilterDialogModel<R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new filter for (a new major row in the dialog filter panel)
|
* Creates a new filter row (a new major row in the dialog filter panel)
|
||||||
* @param logicOperation the logical operation for how this row interacts with preceding rows
|
* @param logicOperation the logical operation for how this row interacts with preceding rows
|
||||||
* @return the new filter row that represents a major row in the dialog filter panel
|
* @return the new filter row that represents a major row in the dialog filter panel
|
||||||
*/
|
*/
|
||||||
|
|||||||
+3
-2
@@ -15,12 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package docking.widgets.table.sort;
|
package docking.widgets.table.sort;
|
||||||
|
|
||||||
|
import static ghidra.util.table.column.GColumnRenderer.ColumnConstraintFilterMode.*;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import ghidra.docking.settings.Settings;
|
import ghidra.docking.settings.Settings;
|
||||||
import ghidra.util.table.column.GColumnRenderer;
|
import ghidra.util.table.column.GColumnRenderer;
|
||||||
import ghidra.util.table.column.GColumnRenderer.ColumnConstraintFilterMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A special version of the backup comparator that uses the column's rendered value for
|
* A special version of the backup comparator that uses the column's rendered value for
|
||||||
@@ -47,7 +48,7 @@ public class ColumnRenderedValueBackupComparator<T> implements Comparator<Object
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
GColumnRenderer<Object> renderer = (GColumnRenderer<Object>) column.getColumnRenderer();
|
GColumnRenderer<Object> renderer = (GColumnRenderer<Object>) column.getColumnRenderer();
|
||||||
if (renderer != null) {
|
if (renderer != null) {
|
||||||
if (renderer.getColumnConstraintFilterMode() == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY) {
|
if (renderer.getColumnConstraintFilterMode() == ALLOW_CONSTRAINTS_FILTER_ONLY) {
|
||||||
// this implies that the column has signaled that it does not support
|
// this implies that the column has signaled that it does not support
|
||||||
// filtering/sorting using its rendered value
|
// filtering/sorting using its rendered value
|
||||||
supportsColumnSorting = false;
|
supportsColumnSorting = false;
|
||||||
|
|||||||
+11
-11
@@ -74,9 +74,9 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
* This variable can be in one of three states:
|
* This variable can be in one of three states:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>null - signals that there is no filter change taking place</li>
|
* <li>null - signals that there is no filter change taking place</li>
|
||||||
* <li>An instance of <code>NullTableFitler</code> - the client has removed the current
|
* <li>An instance of <code>NullTableFilter</code> - the client has removed the current
|
||||||
* filter by calling {@link #setTableFilter(TableFilter)} with a null value</li>
|
* filter by calling {@link #setTableFilter(TableFilter)} with a null value</li>
|
||||||
* <li>An instance of a custom <code>TableFitler</code> - the client has changed the
|
* <li>An instance of a custom <code>TableFilter</code> - the client has changed the
|
||||||
* filter to a non-null value by calling {@link #setTableFilter(TableFilter)}</li>
|
* filter to a non-null value by calling {@link #setTableFilter(TableFilter)}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@@ -399,7 +399,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
*
|
*
|
||||||
* @return true if there is a table filter set.
|
* @return true if there is a table filter set.
|
||||||
*/
|
*/
|
||||||
public boolean hasFitler() {
|
public boolean hasFilter() {
|
||||||
TableFilter<ROW_OBJECT> currentFilter = getTableFilter();
|
TableFilter<ROW_OBJECT> currentFilter = getTableFilter();
|
||||||
return !currentFilter.isEmpty();
|
return !currentFilter.isEmpty();
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasFitler()) {
|
if (!hasFilter()) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,14 +463,14 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given <code>TableFitler</code> on this model. This table filter will then be used
|
* Sets the given <code>TableFilter</code> on this model. This table filter will then be used
|
||||||
* by this model in the default {@link #doFilter(List, TableSortingContext, TaskMonitor)}
|
* by this model in the default {@link #doFilter(List, TableSortingContext, TaskMonitor)}
|
||||||
* method.
|
* method.
|
||||||
* @param tableFitler The filter to use for table filtering.
|
* @param tableFilter The filter to use for table filtering.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setTableFilter(TableFilter<ROW_OBJECT> tableFitler) {
|
public void setTableFilter(TableFilter<ROW_OBJECT> tableFilter) {
|
||||||
this.pendingTableFilter = tableFitler;
|
this.pendingTableFilter = tableFilter;
|
||||||
if (pendingTableFilter == null) {
|
if (pendingTableFilter == null) {
|
||||||
// Don't allow the pending filter to be null in this case. The client has changed
|
// Don't allow the pending filter to be null in this case. The client has changed
|
||||||
// the filter. If we use null, then we don't know the difference between a client
|
// the filter. If we use null, then we don't know the difference between a client
|
||||||
@@ -480,8 +480,8 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
reFilter();
|
reFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAppliedTableFitler(TableFilter<ROW_OBJECT> tableFitler) {
|
private void setAppliedTableFilter(TableFilter<ROW_OBJECT> tableFilter) {
|
||||||
if (tableFitler == null) {
|
if (tableFilter == null) {
|
||||||
// null means there was no change to the text filter--so don't set it (see the
|
// null means there was no change to the text filter--so don't set it (see the
|
||||||
// javadoc for the filter variables)
|
// javadoc for the filter variables)
|
||||||
return;
|
return;
|
||||||
@@ -532,7 +532,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
this.allData = allData;
|
this.allData = allData;
|
||||||
this.filteredData = filteredData;
|
this.filteredData = filteredData;
|
||||||
|
|
||||||
setAppliedTableFitler(pendingTableFilter);
|
setAppliedTableFilter(pendingTableFilter);
|
||||||
pendingSortContext = null;
|
pendingSortContext = null;
|
||||||
|
|
||||||
TableSortingContext<ROW_OBJECT> newSortingContext = filteredData.getSortContext();
|
TableSortingContext<ROW_OBJECT> newSortingContext = filteredData.getSortContext();
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public interface AbstractWrapperTypeColumnRenderer<T> extends GColumnRenderer<T>
|
|||||||
// Overridden to only allow the constraint filtering mechanism.
|
// Overridden to only allow the constraint filtering mechanism.
|
||||||
@Override
|
@Override
|
||||||
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
||||||
return ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY;
|
return ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+4
-11
@@ -83,21 +83,14 @@ public interface GColumnRenderer<T> extends TableCellRenderer {
|
|||||||
public enum ColumnConstraintFilterMode {
|
public enum ColumnConstraintFilterMode {
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
|
||||||
/**
|
|
||||||
* Signals that the programmer didn't make a decision about how filtering for this
|
|
||||||
* column should work. This currently will treat all filtering as if
|
|
||||||
* {@link #USE_COLUMN_RENDERER_FITLER_STRING_ONLY} was chosen.
|
|
||||||
*/
|
|
||||||
DEFAULT,
|
|
||||||
|
|
||||||
/** Use only {@link GColumnRenderer#getFilterString(Object, Settings)} value; no constraints */
|
/** Use only {@link GColumnRenderer#getFilterString(Object, Settings)} value; no constraints */
|
||||||
USE_COLUMN_RENDERER_FITLER_STRING_ONLY,
|
ALLOW_RENDERER_STRING_FILTER_ONLY,
|
||||||
|
|
||||||
/** Use only column constraints when filtering */
|
/** Use only column constraints when filtering */
|
||||||
USE_COLUMN_CONSTRAINTS_ONLY,
|
ALLOW_CONSTRAINTS_FILTER_ONLY,
|
||||||
|
|
||||||
/** Use both the rendered filter String and any found column constraints */
|
/** Use both the rendered filter String and any found column constraints */
|
||||||
USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS,
|
ALLOW_ALL_FILTERS,
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +104,7 @@ public interface GColumnRenderer<T> extends TableCellRenderer {
|
|||||||
* @return the mode
|
* @return the mode
|
||||||
*/
|
*/
|
||||||
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
|
||||||
return ColumnConstraintFilterMode.DEFAULT;
|
return ColumnConstraintFilterMode.ALLOW_RENDERER_STRING_FILTER_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public abstract class VisualGraphComponentProvider<V extends VisualVertex,
|
|||||||
Undo/redo for graph operations (delete; group/ungroup; move)
|
Undo/redo for graph operations (delete; group/ungroup; move)
|
||||||
-rapid pressing will shortcut items
|
-rapid pressing will shortcut items
|
||||||
-undo/redo allows us to prune nodes
|
-undo/redo allows us to prune nodes
|
||||||
--how to maintain old nodes/edges? (FitleringVisualGraph)
|
--how to maintain old nodes/edges? (FilteringVisualGraph)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.graph.job;
|
package ghidra.graph.job;
|
||||||
|
|
||||||
import static util.CollectionUtils.asSet;
|
import static util.CollectionUtils.*;
|
||||||
import static util.CollectionUtils.asStream;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -108,7 +107,7 @@ public class FilterVerticesJob<V extends VisualVertex, E extends VisualEdge<V>>
|
|||||||
passedVertices = matching;
|
passedVertices = matching;
|
||||||
|
|
||||||
// 2)
|
// 2)
|
||||||
failedVertices = findCurrentVerticesFailingTheFitler(matching);
|
failedVertices = findCurrentVerticesFailingTheFilter(matching);
|
||||||
failedEdges = filterGraph.getAllEdges(failedVertices);
|
failedEdges = filterGraph.getAllEdges(failedVertices);
|
||||||
|
|
||||||
Set<E> allRelatedEdges = filterGraph.getAllEdges(passedVertices);
|
Set<E> allRelatedEdges = filterGraph.getAllEdges(passedVertices);
|
||||||
@@ -119,7 +118,7 @@ public class FilterVerticesJob<V extends VisualVertex, E extends VisualEdge<V>>
|
|||||||
filterGraph.unfilterVertices(passedVertices);
|
filterGraph.unfilterVertices(passedVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<V> findCurrentVerticesFailingTheFitler(Set<V> validVertices) {
|
private Set<V> findCurrentVerticesFailingTheFilter(Set<V> validVertices) {
|
||||||
|
|
||||||
UnmodifiableIterator<V> nonMatchingIterator =
|
UnmodifiableIterator<V> nonMatchingIterator =
|
||||||
Iterators.filter(filterGraph.getUnfilteredVertices(), v -> !validVertices.contains(v));
|
Iterators.filter(filterGraph.getUnfilteredVertices(), v -> !validVertices.contains(v));
|
||||||
|
|||||||
Reference in New Issue
Block a user