GP-4594: Fixing regression with library search paths not getting saved

This commit is contained in:
Ryan Kurtz 2024-05-13 07:15:25 -04:00
parent ce970fa416
commit 29f215348a
3 changed files with 10 additions and 17 deletions

View File

@ -79,17 +79,17 @@ public class ScriptPathsPropertyEditor extends AbstractTypedPropertyEditor<Strin
@Override
protected PathnameTablePanel newPathnameTablePanel() {
PathnameTablePanel tablePanel = new ScriptPathsPanel(this::reset);
tablePanel.setFileChooserProperties(getTitle(), "DebuggerLaunchScriptDirectory",
PathnameTablePanel panel = new ScriptPathsPanel(loadPaths(), this::reset);
panel.setFileChooserProperties(getTitle(), "DebuggerLaunchScriptDirectory",
GhidraFileChooserMode.DIRECTORIES_ONLY, true, null);
return tablePanel;
return panel;
}
}
protected class ScriptPathsPanel extends PathnameTablePanel {
public ScriptPathsPanel(Callback resetCallback) {
public ScriptPathsPanel(String[] paths, Callback resetCallback) {
// disable edits, top/bottom irrelevant, unordered
super(null, resetCallback, false, false, false);
super(paths, resetCallback, false, false, false);
}
@Override

View File

@ -43,11 +43,11 @@ public class LibraryPathsDialog extends AbstractPathsDialog {
@Override
protected PathnameTablePanel newPathnameTablePanel() {
// disable edits, add to top, ordered
PathnameTablePanel tablePanel =
new PathnameTablePanel(null, this::reset, false, true, true);
tablePanel.setFileChooserProperties("Select Directory or Filesystem",
PathnameTablePanel panel =
new PathnameTablePanel(loadPaths(), this::reset, false, true, true);
panel.setFileChooserProperties("Select Directory or Filesystem",
"LibrarySearchDirectory", GhidraFileChooserMode.FILES_AND_DIRECTORIES, false, null);
return tablePanel;
return panel;
}
@Override

View File

@ -15,8 +15,6 @@
*/
package docking.widgets.pathmanager;
import javax.swing.JComponent;
import docking.DialogComponentProvider;
public abstract class AbstractPathsDialog extends DialogComponentProvider {
@ -26,7 +24,7 @@ public abstract class AbstractPathsDialog extends DialogComponentProvider {
protected AbstractPathsDialog(String title) {
super(title);
tablePanel = newPathnameTablePanel();
addWorkPanel(buildWorkPanel());
addWorkPanel(tablePanel);
addOKButton();
addCancelButton();
setPreferredSize(600, 400);
@ -44,11 +42,6 @@ public abstract class AbstractPathsDialog extends DialogComponentProvider {
tablePanel.setPaths(paths);
}
protected JComponent buildWorkPanel() {
reset();
return tablePanel;
}
@Override
protected void okCallback() {
String[] paths = tablePanel.getPaths();