mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-28 21:10:05 +08:00
Fixed table dispose not accounting for a wrapped model; Fixed missing
dispose calls of GTableFilterPanel
This commit is contained in:
+1
-1
@@ -343,7 +343,7 @@ public class BundleStatusComponentProvider extends ComponentProviderAdapter {
|
|||||||
* cleanup this component
|
* cleanup this component
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
bundleStatusTable.dispose();
|
filterPanel.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectModelRow(int modelRowIndex) {
|
void selectModelRow(int modelRowIndex) {
|
||||||
|
|||||||
+6
-10
@@ -27,7 +27,6 @@ import docking.help.HelpService;
|
|||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.table.GTableFilterPanel;
|
import docking.widgets.table.GTableFilterPanel;
|
||||||
import docking.widgets.table.TableFilter;
|
import docking.widgets.table.TableFilter;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
|
||||||
import ghidra.app.plugin.core.scalartable.RangeFilterTextField.FilterType;
|
import ghidra.app.plugin.core.scalartable.RangeFilterTextField.FilterType;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||||
@@ -116,8 +115,12 @@ public class ScalarSearchProvider extends ComponentProviderAdapter {
|
|||||||
buffy.append(" [filter: ").append(minValueText).append(']'); // single scalar search
|
buffy.append(" [filter: ").append(minValueText).append(']'); // single scalar search
|
||||||
}
|
}
|
||||||
else if (!isDefaultFilterRange(minValueText, maxValueText)) {
|
else if (!isDefaultFilterRange(minValueText, maxValueText)) {
|
||||||
buffy.append(" [filter: ").append(minValueText).append(" - ").append(
|
buffy.append(" [filter: ")
|
||||||
maxValueText).append(']');
|
.append(minValueText)
|
||||||
|
.append(" - ")
|
||||||
|
.append(
|
||||||
|
maxValueText)
|
||||||
|
.append(']');
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(buffy.toString());
|
setTitle(buffy.toString());
|
||||||
@@ -139,12 +142,6 @@ public class ScalarSearchProvider extends ComponentProviderAdapter {
|
|||||||
return min.equals(Integer.toString(minValue)) && max.equals(Integer.toString(maxValue));
|
return min.equals(Integer.toString(minValue)) && max.equals(Integer.toString(maxValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectDataInProgramFromTable(ProgramSelection selection) {
|
|
||||||
ProgramSelectionPluginEvent pspe =
|
|
||||||
new ProgramSelectionPluginEvent("Selection", selection, plugin.getCurrentProgram());
|
|
||||||
plugin.firePluginEvent(pspe);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentShown() {
|
public void componentShown() {
|
||||||
scalarModel.reload();
|
scalarModel.reload();
|
||||||
@@ -183,7 +180,6 @@ public class ScalarSearchProvider extends ComponentProviderAdapter {
|
|||||||
closeComponent();
|
closeComponent();
|
||||||
threadedTablePanel.dispose();
|
threadedTablePanel.dispose();
|
||||||
filter.dispose();
|
filter.dispose();
|
||||||
scalarTable.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramSelection getSelection() {
|
ProgramSelection getSelection() {
|
||||||
|
|||||||
+27
-29
@@ -16,8 +16,6 @@
|
|||||||
package ghidra.bitpatterns.gui;
|
package ghidra.bitpatterns.gui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -42,13 +40,14 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
private JButton applyLengthFilterButton;
|
private JButton applyLengthFilterButton;
|
||||||
private JButton clearLengthFilterButton;
|
private JButton clearLengthFilterButton;
|
||||||
private JTextField numSeqsField;
|
private JTextField numSeqsField;
|
||||||
|
private GFilterTable<ByteSequenceRowObject> filterTable;
|
||||||
private static final String APPLY_LENGTH_FILTER_BUTTON_TEXT = "Apply Length Filter";
|
private static final String APPLY_LENGTH_FILTER_BUTTON_TEXT = "Apply Length Filter";
|
||||||
private static final String CLEAR_LENGTH_FILTER_BUTTON_TEXT = "Clear Length Filter";
|
private static final String CLEAR_LENGTH_FILTER_BUTTON_TEXT = "Clear Length Filter";
|
||||||
private static final String BYTE_SEQUENCE_LENGTH_FILTER_CREATER_TEXT = "Set Length Filter";
|
private static final String BYTE_SEQUENCE_LENGTH_FILTER_CREATER_TEXT = "Set Length Filter";
|
||||||
private static final String NUM_SEQS_LABEL_TEXT = " Number of Sequences ";
|
private static final String NUM_SEQS_LABEL_TEXT = " Number of Sequences ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link ByteSequencePanelBuilder} in a given {@link FunctionBitPatternPlugin} for sequences of a
|
* Creates a {@link ByteSequencePanelBuilder} in a given {@link FunctionBitPatternsExplorerPlugin} for sequences of a
|
||||||
* given {@PatternType}
|
* given {@PatternType}
|
||||||
* @param plugin plugin
|
* @param plugin plugin
|
||||||
* @param type {@PatternType} of sequences
|
* @param type {@PatternType} of sequences
|
||||||
@@ -59,7 +58,7 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last selected {@link ByteSequenceRowObjects}s of the table associated to
|
* Returns the last selected {@link ByteSequenceRowObject}s of the table associated to
|
||||||
* this panel
|
* this panel
|
||||||
* @return the selected objects
|
* @return the selected objects
|
||||||
*/
|
*/
|
||||||
@@ -121,7 +120,7 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
|
|
||||||
mainPanel.add(getButtonPanel(), BorderLayout.SOUTH);
|
mainPanel.add(getButtonPanel(), BorderLayout.SOUTH);
|
||||||
byteSeqTable = new DisassembledByteSequenceTableModel(plugin, rowObjects);
|
byteSeqTable = new DisassembledByteSequenceTableModel(plugin, rowObjects);
|
||||||
GFilterTable<ByteSequenceRowObject> filterTable = new GFilterTable<>(byteSeqTable);
|
filterTable = new GFilterTable<>(byteSeqTable);
|
||||||
mainPanel.add(filterTable, BorderLayout.CENTER, TABLE_INDEX);
|
mainPanel.add(filterTable, BorderLayout.CENTER, TABLE_INDEX);
|
||||||
addLengthFilterAndAnalysisButtons();
|
addLengthFilterAndAnalysisButtons();
|
||||||
mainPanel.setVisible(true);
|
mainPanel.setVisible(true);
|
||||||
@@ -133,10 +132,12 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
*/
|
*/
|
||||||
public void updateTable() {
|
public void updateTable() {
|
||||||
mainPanel.remove(TABLE_INDEX);
|
mainPanel.remove(TABLE_INDEX);
|
||||||
|
filterTable.dispose();
|
||||||
|
|
||||||
rowObjects = ByteSequenceRowObject.getFilteredRowObjects(fsReader.getFInfoList(), type,
|
rowObjects = ByteSequenceRowObject.getFilteredRowObjects(fsReader.getFInfoList(), type,
|
||||||
getContextRegisterFilter(), lengthFilter);
|
getContextRegisterFilter(), lengthFilter);
|
||||||
byteSeqTable = new DisassembledByteSequenceTableModel(plugin, rowObjects);
|
byteSeqTable = new DisassembledByteSequenceTableModel(plugin, rowObjects);
|
||||||
GFilterTable<ByteSequenceRowObject> filterTable = new GFilterTable<>(byteSeqTable);
|
filterTable = new GFilterTable<>(byteSeqTable);
|
||||||
|
|
||||||
int totalNumSeqs = 0;
|
int totalNumSeqs = 0;
|
||||||
for (ByteSequenceRowObject row : rowObjects) {
|
for (ByteSequenceRowObject row : rowObjects) {
|
||||||
@@ -149,7 +150,7 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link FileBitsPatternInfoReader} object to use a data source
|
* Sets the {@link FileBitPatternInfoReader} object to use a data source
|
||||||
* @param fsReader {@link FileBitPatternInfoReader} object containing the sequences to analyze
|
* @param fsReader {@link FileBitPatternInfoReader} object containing the sequences to analyze
|
||||||
*/
|
*/
|
||||||
public void setFsReader(FileBitPatternInfoReader fsReader) {
|
public void setFsReader(FileBitPatternInfoReader fsReader) {
|
||||||
@@ -163,43 +164,40 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
|
|||||||
|
|
||||||
applyLengthFilterButton = new JButton(APPLY_LENGTH_FILTER_BUTTON_TEXT);
|
applyLengthFilterButton = new JButton(APPLY_LENGTH_FILTER_BUTTON_TEXT);
|
||||||
getButtonPanel().add(applyLengthFilterButton);
|
getButtonPanel().add(applyLengthFilterButton);
|
||||||
applyLengthFilterButton.addActionListener(new ActionListener() {
|
applyLengthFilterButton.addActionListener(e -> {
|
||||||
|
ByteSequenceLengthFilterInputDialog filterCreator =
|
||||||
@Override
|
new ByteSequenceLengthFilterInputDialog(
|
||||||
public void actionPerformed(ActionEvent e) {
|
BYTE_SEQUENCE_LENGTH_FILTER_CREATER_TEXT, mainPanel);
|
||||||
ByteSequenceLengthFilterInputDialog filterCreator =
|
if (filterCreator.isCanceled()) {
|
||||||
new ByteSequenceLengthFilterInputDialog(
|
return;
|
||||||
BYTE_SEQUENCE_LENGTH_FILTER_CREATER_TEXT, mainPanel);
|
|
||||||
if (filterCreator.isCanceled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lengthFilter = filterCreator.getValue();
|
|
||||||
applyFilterAction();
|
|
||||||
}
|
}
|
||||||
|
lengthFilter = filterCreator.getValue();
|
||||||
|
applyFilterAction();
|
||||||
});
|
});
|
||||||
|
|
||||||
clearLengthFilterButton = new JButton(CLEAR_LENGTH_FILTER_BUTTON_TEXT);
|
clearLengthFilterButton = new JButton(CLEAR_LENGTH_FILTER_BUTTON_TEXT);
|
||||||
getButtonPanel().add(clearLengthFilterButton);
|
getButtonPanel().add(clearLengthFilterButton);
|
||||||
clearLengthFilterButton.addActionListener(new ActionListener() {
|
clearLengthFilterButton.addActionListener(e -> {
|
||||||
@Override
|
lengthFilter = null;
|
||||||
public void actionPerformed(ActionEvent e) {
|
updateTable();
|
||||||
lengthFilter = null;
|
|
||||||
updateTable();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the "Apply Length Filter" and "Clear Length Filter" buttons based on a boolean input
|
* Enables the "Apply Length Filter" and "Clear Length Filter" buttons based on a boolean input
|
||||||
* @param buttons will be enabled precisely when this parameter is {@code true}
|
* @param enabled will be enabled precisely when this parameter is {@code true}
|
||||||
*/
|
*/
|
||||||
public void enableLengthFilterButtons(boolean x) {
|
public void enableLengthFilterButtons(boolean enabled) {
|
||||||
if (applyLengthFilterButton != null) {
|
if (applyLengthFilterButton != null) {
|
||||||
applyLengthFilterButton.setEnabled(x);
|
applyLengthFilterButton.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
if (clearLengthFilterButton != null) {
|
if (clearLengthFilterButton != null) {
|
||||||
clearLengthFilterButton.setEnabled(x);
|
clearLengthFilterButton.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
filterTable.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-7
@@ -88,13 +88,10 @@ public class ClipboardPanel extends JPanel {
|
|||||||
buttonPanel = new JPanel(new FlowLayout());
|
buttonPanel = new JPanel(new FlowLayout());
|
||||||
|
|
||||||
JButton deletedButton = new JButton("Remove Selected Patterns");
|
JButton deletedButton = new JButton("Remove Selected Patterns");
|
||||||
deletedButton.addActionListener(new ActionListener() {
|
deletedButton.addActionListener(e -> {
|
||||||
@Override
|
List<PatternInfoRowObject> selected = filterTable.getSelectedRowObjects();
|
||||||
public void actionPerformed(ActionEvent e) {
|
plugin.removePatterns(selected);
|
||||||
List<PatternInfoRowObject> selected = filterTable.getSelectedRowObjects();
|
updateClipboard();
|
||||||
plugin.removePatterns(selected);
|
|
||||||
updateClipboard();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
buttonPanel.add(deletedButton);
|
buttonPanel.add(deletedButton);
|
||||||
|
|
||||||
@@ -415,6 +412,7 @@ public class ClipboardPanel extends JPanel {
|
|||||||
*/
|
*/
|
||||||
public void updateClipboard() {
|
public void updateClipboard() {
|
||||||
remove(filterTable);
|
remove(filterTable);
|
||||||
|
filterTable.dispose();
|
||||||
patternInfoTable = new PatternInfoTableModel(plugin);
|
patternInfoTable = new PatternInfoTableModel(plugin);
|
||||||
filterTable = new GFilterTable<>(patternInfoTable);
|
filterTable = new GFilterTable<>(patternInfoTable);
|
||||||
add(filterTable, 0);
|
add(filterTable, 0);
|
||||||
@@ -495,4 +493,7 @@ public class ClipboardPanel extends JPanel {
|
|||||||
return patternInfoTable.getLastSelectedObjects();
|
return patternInfoTable.getLastSelectedObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
filterTable.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-4
@@ -41,8 +41,9 @@ public class ClosedPatternTableDialog extends DialogComponentProvider {
|
|||||||
private DockingAction sendToClipboardAction;
|
private DockingAction sendToClipboardAction;
|
||||||
private static final String TITLE = "Closed Patterns";
|
private static final String TITLE = "Closed Patterns";
|
||||||
private ClosedPatternTableModel closedPatternTableModel;
|
private ClosedPatternTableModel closedPatternTableModel;
|
||||||
private FunctionBitPatternsExplorerPlugin plugin;
|
private GThreadedTablePanel<ClosedPatternRowObject> tablePanel;
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
|
private FunctionBitPatternsExplorerPlugin plugin;
|
||||||
private PatternType type;
|
private PatternType type;
|
||||||
private ContextRegisterFilter cRegFilter;
|
private ContextRegisterFilter cRegFilter;
|
||||||
|
|
||||||
@@ -77,9 +78,8 @@ public class ClosedPatternTableDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
private JPanel createMainPanel() {
|
private JPanel createMainPanel() {
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
GThreadedTablePanel<ClosedPatternRowObject> table =
|
tablePanel = new GThreadedTablePanel<>(closedPatternTableModel);
|
||||||
new GThreadedTablePanel<>(closedPatternTableModel);
|
panel.add(tablePanel, BorderLayout.CENTER);
|
||||||
panel.add(table, BorderLayout.CENTER);
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,4 +122,8 @@ public class ClosedPatternTableDialog extends DialogComponentProvider {
|
|||||||
this.addAction(sendToClipboardAction);
|
this.addAction(sendToClipboardAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
tablePanel.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -451,6 +451,8 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
|
|||||||
* Removes the action from the tool.
|
* Removes the action from the tool.
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
firstBytesPanel.dispose();
|
||||||
|
clipboard.dispose();
|
||||||
tool.removeAction(gatherDataFromProgramAction);
|
tool.removeAction(gatherDataFromProgramAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -308,6 +308,7 @@ public class FidSearchResultFrame extends JFrame implements FidQueryCloseListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
table.dispose();
|
||||||
dbService.removeCloseListener(this);
|
dbService.removeCloseListener(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -70,6 +70,11 @@ public class ListSelectionTableDialog<T> extends DialogComponentProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
filterPanel.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
private JComponent build() {
|
private JComponent build() {
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
||||||
@@ -127,7 +132,7 @@ public class ListSelectionTableDialog<T> extends DialogComponentProvider {
|
|||||||
public void setMultiSelectionMode(boolean enable) {
|
public void setMultiSelectionMode(boolean enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
gTable.getSelectionModel()
|
gTable.getSelectionModel()
|
||||||
.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
gTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
|||||||
+5
@@ -89,4 +89,9 @@ public class ObjectChooserDialog<T> extends DialogComponentProvider {
|
|||||||
public void setFilterText(String text) {
|
public void setFilterText(String text) {
|
||||||
table.setFilterText(text);
|
table.setFilterText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
table.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,12 +93,14 @@ public class TableChooserDialog<T> extends DialogComponentProvider {
|
|||||||
protected void okCallback() {
|
protected void okCallback() {
|
||||||
selectedItems = gFilterTable.getSelectedRowObjects();
|
selectedItems = gFilterTable.getSelectedRowObjects();
|
||||||
close();
|
close();
|
||||||
|
gFilterTable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void cancelCallback() {
|
protected void cancelCallback() {
|
||||||
selectedItems = null;
|
selectedItems = null;
|
||||||
close();
|
close();
|
||||||
|
gFilterTable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+12
@@ -555,4 +555,16 @@ public abstract class GDynamicColumnTableModel<ROW_TYPE, DATA_SOURCE>
|
|||||||
DynamicTableColumn<ROW_TYPE, ?, ?> column = tableColumns.get(index);
|
DynamicTableColumn<ROW_TYPE, ?, ?> column = tableColumns.get(index);
|
||||||
return column.getMaxLines(columnSettings.get(column));
|
return column.getMaxLines(columnSettings.get(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
disposeDynamicColumnData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void disposeDynamicColumnData() {
|
||||||
|
tableColumns.clear();
|
||||||
|
defaultTableColumns.clear();
|
||||||
|
columnSettings.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class GFilterTable<ROW_OBJECT> extends JPanel {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
filterPanel.dispose();
|
filterPanel.dispose();
|
||||||
table.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildTable() {
|
private void buildTable() {
|
||||||
|
|||||||
@@ -279,8 +279,9 @@ public class GTable extends JTable {
|
|||||||
* Call this when the table will no longer be used
|
* Call this when the table will no longer be used
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (dataModel instanceof AbstractGTableModel) {
|
TableModel unwrappedeModel = getUnwrappedTableModel();
|
||||||
((AbstractGTableModel<?>) dataModel).dispose();
|
if (unwrappedeModel instanceof AbstractGTableModel) {
|
||||||
|
((AbstractGTableModel<?>) unwrappedeModel).dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columnModel instanceof GTableColumnModel) {
|
if (columnModel instanceof GTableColumnModel) {
|
||||||
|
|||||||
@@ -223,4 +223,8 @@ public class GTableWidget<T> extends JPanel {
|
|||||||
public void setFilterText(String text) {
|
public void setFilterText(String text) {
|
||||||
gFilterTable.setFiterText(text);
|
gFilterTable.setFiterText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
gFilterTable.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -23,6 +23,7 @@ import javax.swing.*;
|
|||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
import ghidra.util.Swing;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
import ghidra.util.task.TaskMonitorComponent;
|
import ghidra.util.task.TaskMonitorComponent;
|
||||||
import resources.Icons;
|
import resources.Icons;
|
||||||
@@ -30,6 +31,8 @@ import resources.Icons;
|
|||||||
/**
|
/**
|
||||||
* A convenience component designed specifically for rendering threaded table models.
|
* A convenience component designed specifically for rendering threaded table models.
|
||||||
* This panel will automatically create a threaded table and a task monitor component.
|
* This panel will automatically create a threaded table and a task monitor component.
|
||||||
|
*
|
||||||
|
* @param <T> the type
|
||||||
*/
|
*/
|
||||||
public class GThreadedTablePanel<T> extends JPanel {
|
public class GThreadedTablePanel<T> extends JPanel {
|
||||||
|
|
||||||
@@ -135,7 +138,6 @@ public class GThreadedTablePanel<T> extends JPanel {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
threadedModel.dispose();
|
threadedModel.dispose();
|
||||||
table.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskMonitor getTaskMonitor() {
|
public TaskMonitor getTaskMonitor() {
|
||||||
@@ -162,22 +164,23 @@ public class GThreadedTablePanel<T> extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the underlying table.
|
* Returns the underlying table
|
||||||
|
* @return the table
|
||||||
*/
|
*/
|
||||||
public GTable getTable() {
|
public GTable getTable() {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUpdatePending() {
|
private void handleUpdatePending() {
|
||||||
SwingUtilities.invokeLater(showPendingRunnable);
|
Swing.runLater(showPendingRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUpdating() {
|
private void handleUpdating() {
|
||||||
SwingUtilities.invokeLater(showProgressRunnable);
|
Swing.runLater(showProgressRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUpdateComplete() {
|
private void handleUpdateComplete() {
|
||||||
SwingUtilities.invokeLater(updateCompleteRunnable);
|
Swing.runLater(updateCompleteRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doUpdateComplete() {
|
private void doUpdateComplete() {
|
||||||
|
|||||||
+6
-5
@@ -24,6 +24,7 @@ import docking.widgets.table.*;
|
|||||||
import docking.widgets.table.sort.DefaultColumnComparator;
|
import docking.widgets.table.sort.DefaultColumnComparator;
|
||||||
import generic.concurrent.ConcurrentListenerSet;
|
import generic.concurrent.ConcurrentListenerSet;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
|
import ghidra.util.Swing;
|
||||||
import ghidra.util.SystemUtilities;
|
import ghidra.util.SystemUtilities;
|
||||||
import ghidra.util.datastruct.*;
|
import ghidra.util.datastruct.*;
|
||||||
import ghidra.util.exception.*;
|
import ghidra.util.exception.*;
|
||||||
@@ -123,7 +124,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
TaskMonitor monitor, boolean loadIncrementally) {
|
TaskMonitor monitor, boolean loadIncrementally) {
|
||||||
super(serviceProvider);
|
super(serviceProvider);
|
||||||
|
|
||||||
if (!SwingUtilities.isEventDispatchThread()) {
|
if (!Swing.isSwingThread()) {
|
||||||
throw new AssertException(
|
throw new AssertException(
|
||||||
"You must create the ThreadedTableModel in the AWT Event Dispatch Thread");
|
"You must create the ThreadedTableModel in the AWT Event Dispatch Thread");
|
||||||
}
|
}
|
||||||
@@ -143,7 +144,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
// We are expecting to be in the swing thread. We want the reload to happen after our
|
// We are expecting to be in the swing thread. We want the reload to happen after our
|
||||||
// constructor is fully completed since the reload will cause our initialize method to
|
// constructor is fully completed since the reload will cause our initialize method to
|
||||||
// be called in another thread, thereby creating a possible race condition.
|
// be called in another thread, thereby creating a possible race condition.
|
||||||
SwingUtilities.invokeLater(() -> updateManager.reload());
|
Swing.runLater(() -> updateManager.reload());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoadIncrementally() {
|
public boolean isLoadIncrementally() {
|
||||||
@@ -617,12 +618,11 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void fireTableChanged(TableModelEvent e) {
|
public void fireTableChanged(TableModelEvent e) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (Swing.isSwingThread()) {
|
||||||
super.fireTableChanged(e);
|
super.fireTableChanged(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final TableModelEvent e1 = e;
|
Swing.runLater(() -> ThreadedTableModel.super.fireTableChanged(e));
|
||||||
SwingUtilities.invokeLater(() -> ThreadedTableModel.super.fireTableChanged(e1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -636,6 +636,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
|||||||
worker.dispose();
|
worker.dispose();
|
||||||
}
|
}
|
||||||
doClearData();
|
doClearData();
|
||||||
|
disposeDynamicColumnData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-5
@@ -21,14 +21,12 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
import javax.swing.table.TableColumnModel;
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.widgets.table.GTableCellRenderer;
|
import docking.widgets.table.*;
|
||||||
import docking.widgets.table.GTableCellRenderingData;
|
|
||||||
import docking.widgets.table.threaded.GThreadedTablePanel;
|
import docking.widgets.table.threaded.GThreadedTablePanel;
|
||||||
import docking.widgets.table.threaded.ThreadedTableModelListener;
|
import docking.widgets.table.threaded.ThreadedTableModelListener;
|
||||||
import ghidra.framework.main.datatable.ProjectDataContext;
|
import ghidra.framework.main.datatable.ProjectDataContext;
|
||||||
@@ -46,7 +44,7 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
|
|||||||
private FindCheckoutsTableModel model;
|
private FindCheckoutsTableModel model;
|
||||||
private Plugin plugin;
|
private Plugin plugin;
|
||||||
private DomainFolder folder;
|
private DomainFolder folder;
|
||||||
private JTable table;
|
private GTable table;
|
||||||
private boolean showMessage = true;
|
private boolean showMessage = true;
|
||||||
private GThreadedTablePanel<CheckoutInfo> threadedTablePanel;
|
private GThreadedTablePanel<CheckoutInfo> threadedTablePanel;
|
||||||
|
|
||||||
@@ -123,7 +121,7 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
super.close();
|
super.close();
|
||||||
model.dispose();
|
threadedTablePanel.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -99,8 +99,6 @@ public class KeyBindingsPanel extends JPanel {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
tableFilterPanel.dispose();
|
tableFilterPanel.dispose();
|
||||||
tableModel.dispose();
|
|
||||||
actionTable.dispose();
|
|
||||||
propertyChangeListener = null;
|
propertyChangeListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-6
@@ -71,7 +71,7 @@ public class PluginInstallerDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dialogShown() {
|
protected void dialogShown() {
|
||||||
// users often wish to start typing in the filter when the dialog appeears
|
// users often wish to start typing in the filter when the dialog appears
|
||||||
tableFilterPanel.requestFocus();
|
tableFilterPanel.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,6 @@ public class PluginInstallerDialog extends DialogComponentProvider {
|
|||||||
public void close() {
|
public void close() {
|
||||||
super.close();
|
super.close();
|
||||||
tableFilterPanel.dispose();
|
tableFilterPanel.dispose();
|
||||||
table.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,10 +172,14 @@ public class PluginInstallerDialog extends DialogComponentProvider {
|
|||||||
TableSortState.createDefaultSortState(PluginInstallerTableModel.NAME_COL));
|
TableSortState.createDefaultSortState(PluginInstallerTableModel.NAME_COL));
|
||||||
tableModel.refresh();
|
tableModel.refresh();
|
||||||
|
|
||||||
table.getColumnModel().getColumn(PluginInstallerTableModel.NAME_COL).setCellRenderer(
|
table.getColumnModel()
|
||||||
new NameCellRenderer());
|
.getColumn(PluginInstallerTableModel.NAME_COL)
|
||||||
table.getColumnModel().getColumn(PluginInstallerTableModel.STATUS_COL).setCellRenderer(
|
.setCellRenderer(
|
||||||
new StatusCellRenderer());
|
new NameCellRenderer());
|
||||||
|
table.getColumnModel()
|
||||||
|
.getColumn(PluginInstallerTableModel.STATUS_COL)
|
||||||
|
.setCellRenderer(
|
||||||
|
new StatusCellRenderer());
|
||||||
|
|
||||||
HelpService help = Help.getHelpService();
|
HelpService help = Help.getHelpService();
|
||||||
help.registerHelp(table, new HelpLocation(GenericHelpTopics.TOOL, "PluginDialog"));
|
help.registerHelp(table, new HelpLocation(GenericHelpTopics.TOOL, "PluginDialog"));
|
||||||
|
|||||||
Reference in New Issue
Block a user