GT-2875 - Unswingable - review fixes

This commit is contained in:
dragonmacher 2019-05-21 14:51:32 -04:00
parent 5e8340b7f8
commit 31f3cca1a5
27 changed files with 100 additions and 79 deletions

View file

@ -32,10 +32,10 @@ import docking.event.mouse.GMouseListenerAdapter;
import docking.menu.DockingToolbarButton;
import docking.util.*;
import docking.widgets.label.GDHtmlLabel;
import ghidra.generic.function.Callback;
import ghidra.util.*;
import ghidra.util.exception.AssertException;
import ghidra.util.task.*;
import utility.function.Callback;
/**
* Base class used for creating dialogs in Ghidra. Subclass this to create a dialog provider that has

View file

@ -22,10 +22,10 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import ghidra.generic.function.Callback;
import ghidra.util.SystemUtilities;
import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
import utility.function.Callback;
/**
* A text field that is meant to be used in conjunction with tables that allow filter text. This

View file

@ -28,10 +28,10 @@ import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.filechooser.GhidraFileChooserMode;
import docking.widgets.table.*;
import ghidra.framework.preferences.Preferences;
import ghidra.generic.function.Callback;
import ghidra.util.filechooser.GhidraFileChooserModel;
import ghidra.util.filechooser.GhidraFileFilter;
import resources.ResourceManager;
import utility.function.Callback;
/**
* Component that has a table to show pathnames; the panel includes buttons to control

View file

@ -40,7 +40,6 @@ import docking.widgets.table.columnfilter.ColumnBasedTableFilter;
import docking.widgets.table.columnfilter.ColumnFilterSaveManager;
import docking.widgets.table.constraint.dialog.ColumnFilterDialog;
import ghidra.framework.options.PreferenceState;
import ghidra.generic.function.Callback;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.datastruct.WeakDataStructureFactory;
@ -50,6 +49,7 @@ import ghidra.util.task.SwingUpdateManager;
import resources.Icons;
import resources.ResourceManager;
import utilities.util.reflection.ReflectionUtilities;
import utility.function.Callback;
/**
* This class is a panel that provides a label and text field that allows users to input text that

View file

@ -33,11 +33,11 @@ import docking.widgets.table.GTableFilterPanel;
import docking.widgets.table.RowObjectFilterModel;
import docking.widgets.table.columnfilter.*;
import docking.widgets.table.constrainteditor.ColumnConstraintEditor;
import ghidra.generic.function.Callback;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.layout.VerticalLayout;
import resources.ResourceManager;
import utility.function.Callback;
/**
* Dialog for creating and editing column table filters.

View file

@ -176,8 +176,8 @@ public class TaskBuilder {
/**
* Sets the amount of time that will pass before showing the dialog. The default is
* {@link TaskLauncher#INITIAL_DELAY} for non-modal tasks and
* {@link TaskLauncher#INITIAL_MODAL_DELAY} for modal tasks.
* {@link TaskLauncher#INITIAL_DELAY_MS} for non-modal tasks and
* {@link TaskLauncher#INITIAL_MODAL_DELAY_MS} for modal tasks.
*
* @param delay the delay time
* @return this builder

View file

@ -23,12 +23,19 @@ import ghidra.util.exception.UnableToSwingException;
/**
* Class to initiate a Task in a new Thread, and to show a progress dialog that indicates
* activity. The progress dialog will show an animation in the event that the task of this class
* cannot show progress.
* activity <b>if the task takes too long</b>. The progress dialog will show an
* animation in the event that the task of this class cannot show progress.
*
* <p>For complete control of how this class functions, use
* {@link #TaskLauncher(Task, Component, int, int)}. Alternatively, for simpler uses,
* see one of the many static convenience methods.
*
* <p><b>Important Usage Note:</b><br>
* For clients that are not on the Swing thread the behavior of this class is designed to
* prevent deadlocks. When called from a non-Swing thread, this class will attempt to show a
* modal dialog. However, if more than {@link #getSwingTimeoutInSeconds()} elapses while waiting
* for the Swing thread, then this class will <b>give up on using the Swing thread and will not
* create a background thread</b>. Instead, the client code will be run in the client thread.
*
* <a name="modal_usage"></a>
* <p><b><a name="modal_usage">Modal Usage</a></b><br>
@ -250,12 +257,12 @@ public class TaskLauncher {
Swing.runNow(() -> runner.run(), timeout, TimeUnit.SECONDS);
}
// template method to allow timeout change
// template method to allow timeout change; used by tests
protected int getSwingTimeoutInSeconds() {
return 2;
}
// template method to allow task runner change
// template method to allow task runner change; used by tests
protected TaskRunner createTaskRunner(Task task, Component parent, int delayMs,
int dialogWidth) {
return new TaskRunner(task, parent, delayMs, dialogWidth);