Merge remote-tracking branch 'origin/GT-3142-dragonmacher-table-sort-duplication' into Ghidra_9.1

This commit is contained in:
Ryan Kurtz 2019-09-13 08:13:05 -04:00
commit cb03588e52
6 changed files with 24 additions and 5 deletions

View file

@ -51,6 +51,11 @@ public class CombinedTableFilter<T> implements TableFilter<T> {
return true;
}
@Override
public boolean isEmpty() {
return filters.isEmpty();
}
/**
* Returns the number of sub-filters in this combined filter.
*

View file

@ -48,4 +48,13 @@ public interface TableFilter<ROW_OBJECT> {
return false;
}
/**
* A method that allows filters to report that they have nothing to actually filter. This
* is useful for empty/null filters.
*
* @return true if this filter will not perform any filtering
*/
public default boolean isEmpty() {
return false;
}
}

View file

@ -39,6 +39,11 @@ public class NullTableFilter<ROW_OBJECT> implements TableFilter<ROW_OBJECT> {
return false;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

View file

@ -26,7 +26,7 @@ import ghidra.util.SystemUtilities;
* encapsulates the actual data, along with any filter applied, any sort applied, along with
* some convenience methods for performing operations on this group of data.
*
* @param <ROW_OBJECT>
* @param <ROW_OBJECT> the row type
*/
public class TableData<ROW_OBJECT> implements Iterable<ROW_OBJECT> {

View file

@ -322,7 +322,7 @@ public class TableUpdateJob<T> {
/**
* Calls the appropriate method to process the given state.
* @param state the state to process.
* @throws CancelledException
* @throws CancelledException if the job was cancelled
*/
private void processState(JobState state) throws CancelledException {
switch (state) {

View file

@ -162,7 +162,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
*
* @param monitor the monitor
* @return the loaded data
* @throws CancelledException
* @throws CancelledException if the load was cancelled
*/
final List<ROW_OBJECT> load(TaskMonitor monitor) throws CancelledException {
if (loadIncrementally) {
@ -371,7 +371,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
*/
public boolean hasFitler() {
TableFilter<ROW_OBJECT> currentFilter = getTableFilter();
return !(currentFilter instanceof NullTableFilter);
return !currentFilter.isEmpty();
}
/**
@ -772,7 +772,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
* Adds a listener that will be notified of the first table load of this model. After the
* initial load, the listener is removed.
*
* @param listener
* @param listener the listener
*/
public void addInitialLoadListener(ThreadedTableModelListener listener) {
listeners.add(new OneTimeListenerWrapper(listener));