Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-2-8-23'

This commit is contained in:
Ryan Kurtz 2023-02-09 06:04:54 -05:00
commit dbaff145d4
2 changed files with 25 additions and 15 deletions

View file

@ -1063,11 +1063,15 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement
@Override
public void close() {
closeCleanup();
super.close();
}
private void closeCleanup() {
clearBackHistory();
cancelEdits();
clearStatusText();
savePreferences();
super.close();
}
private void savePreferences() {
@ -1511,9 +1515,12 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement
@Override
public void dispose() {
super.dispose();
closeCleanup();
modelUpdater.dispose();
actionManager.dispose();
optionsDialog.dispose();
close();
worker.dispose();
fileChooserModel = null;
}
@ -1956,8 +1963,17 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement
@Override
public void run(TaskMonitor monitor) {
if (monitor.isCancelled()) {
return;
}
run();
SystemUtilities.runSwingLater(() -> runSwing());
Swing.runLater(() -> {
if (!monitor.isCancelled()) {
runSwing();
}
});
}
public void run() {
@ -2023,10 +2039,6 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement
@Override
public void run() {
if (fileChooserModel == null) {
return;
}
loadedFiles =
new ArrayList<>(fileChooserModel.getListing(directory, GhidraFileChooser.this));
Collections.sort(loadedFiles, new FileComparator(fileChooserModel));
@ -2055,9 +2067,6 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement
@Override
public void run() {
if (fileChooserModel == null) {
return;
}
roots = new ArrayList<>(fileChooserModel.getRoots(forceUpdate));
Collections.sort(roots);
}

View file

@ -15,10 +15,9 @@
*/
package ghidra.util.filechooser;
import java.util.List;
import java.io.File;
import java.io.FileFilter;
import java.util.List;
import javax.swing.Icon;
@ -71,6 +70,7 @@ public interface GhidraFileChooserModel {
* exist in the specified directory.
*
* @param directory the directory
* @param filter the file filter; may be null
* @return list of files
*/
public List<File> getListing(File directory, FileFilter filter);
@ -100,8 +100,8 @@ public interface GhidraFileChooserModel {
public boolean createDirectory(File directory, String name);
/**
* Tests whether the file denoted by this abstract pathname is a
* directory.
* Tests whether the file denoted by this abstract pathname is a directory.
* @param file the file
* @return <code>true</code> if and only if the file denoted by this
* abstract pathname exists <em>and</em> is a directory;
* <code>false</code> otherwise
@ -114,13 +114,14 @@ public interface GhidraFileChooserModel {
* absolute if its prefix is <code>"/"</code>. On Microsoft Windows systems, a
* pathname is absolute if its prefix is a drive specifier followed by
* <code>"\\"</code>, or if its prefix is <code>"\\"</code>.
* @param file the file
* @return <code>true</code> if this abstract pathname is absolute,
* <code>false</code> otherwise
*/
public boolean isAbsolute(File file);
/**
* Renames the src file to the dest file.
* Renames the src file to the destination file.
* @param src the file to be renamed
* @param dest the new file
* @return true if the file was renamed