Class PathnameTablePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PathnameTablePanel extends JPanel
Component that has a table to show pathnames; the panel includes buttons to control the order of the paths, and to add and remove paths. The add button brings up a file chooser. Call the setFileChooser() method to control how the file chooser should behave. If the table entries should not be edited, call setEditingEnabled(false).
See Also:
  • Constructor Details

    • PathnameTablePanel

      public PathnameTablePanel(String[] paths, boolean enableEdits, boolean addToTop, boolean ordered)
      Construct a new PathnameTablePanel.
      Parameters:
      paths - list of paths to show; may be null
      enableEdits - true to allow editing of entries directly in the table, i.e., via the cell editor. The add and remove buttons still allow modification of the list.
      addToTop - true if the add button should add entries to the top of the list. False to add entries to the bottom. This behavior is overridden if if ordered is false.
      ordered - true if the order of entries matters. If so, up and down buttons are provided so the user may arrange the entries. If not, entries are sorted alphabetically.
    • PathnameTablePanel

      public PathnameTablePanel(String[] paths, Callback resetCallback, boolean enableEdits, boolean addToTop, boolean ordered)
      Construct a new PathnameTablePanel with a reset button
      Parameters:
      paths - list of paths to show; may be null
      resetCallback - callback containing the action to perform if the reset button is pressed
      enableEdits - true to allow editing of entries directly in the table, i.e., via the cell editor. The add and remove buttons still allow modification of the list.
      addToTop - true if the add button should add entries to the top of the list. False to add entries to the bottom. This behavior is overridden if if ordered is false.
      ordered - true if the order of entries matters. If so, up and down buttons are provided so the user may arrange the entries. If not, entries are sorted alphabetically.
  • Method Details

    • setFileChooserProperties

      public void setFileChooserProperties(String title, String preferenceForLastSelectedDir, GhidraFileChooserMode selectionMode, boolean allowMultiSelection, GhidraFileFilter filter)
      Set properties on the file chooser that is displayed when the "Add" button is pressed.
      Parameters:
      title - title of the file chooser
      preferenceForLastSelectedDir - Preference to use as the current directory in the file chooser
      selectionMode - mode defined in GhidraFileFilter, e.g., GhidraFileFilter.FILES_ONLY
      allowMultiSelection - true if multiple files can be selected
      filter - filter to use; may be null if no filtering is required
    • setEditingEnabled

      public void setEditingEnabled(boolean enableEdits)
      Set whether the entries in the table can be edited.
      Parameters:
      enableEdits - false means to not allow editing; the table is editable by default.
    • setAddToTop

      public void setAddToTop(boolean addToTop)
      Set whether new paths should be added to the top of the table (true) or at the end of the table (false).
      Parameters:
      addToTop - true means to add to the top of the table
    • setOrdered

      public void setOrdered(boolean ordered)
      Set whether the order of entries in the table matters.

      WARNING: When this is set to false, the entries are immediately sorted and the up and down buttons removed. Setting it back to true will replace the buttons, but will not restore the order. In general, this should be set once, at the start of the table's life cycle.

      Parameters:
      ordered - true means the user can control the order, false means they cannot.
    • getPaths

      public String[] getPaths()
    • setPaths

      public void setPaths(String[] paths)
    • getTable

      public JTable getTable()
    • clear

      public void clear()
      Clear the paths in the table.
    • promptConfirmReset

      protected int promptConfirmReset()