Package docking.widgets.pathmanager
Class PathManager
java.lang.Object
docking.widgets.pathmanager.PathManager
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).
-
Constructor Summary
ConstructorDescriptionPathManager
(boolean addToTop, boolean allowOrdering) PathManager
(List<Path> paths, boolean addToTop, boolean allowOrdering) Construct a new PathnameTablePanel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(PathManagerListener listener) boolean
addPath
(ResourceFile file, boolean enabled) Add a new file path and set its enablementvoid
clear()
Clear the paths in the table.void
dispose()
Returns the GUI component for the path manager.static Path[]
getPathsFromPreferences
(String enablePathKey, Path[] defaultEnablePaths, String disabledPathKey) Restore paths from user Preferences using the specified keys.void
removeListener
(PathManagerListener listener) void
restoreFromPreferences
(String enablePathKey, Path[] defaultEnablePaths, String disabledPathKey) Restore paths from user Preferences using the specified keys.void
Restores the paths from the specified SaveState object.static boolean
savePathsToPreferences
(String enablePathKey, String disabledPathKey, Path[] paths) Save the specified paths to the user Preferences using the specified keys.void
Saves the paths to the specified SaveState object.boolean
saveToPreferences
(String enablePathKey, String disabledPathKey) 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.void
-
Constructor Details
-
PathManager
Construct a new PathnameTablePanel.- Parameters:
paths
- list of paths to show; may be nulladdToTop
- true if new paths are to be added to the top of the table, falseallowOrdering
- if true the ability to move path items up/down will be provided if new paths are to be added to the end of the table
-
PathManager
public PathManager(boolean addToTop, boolean allowOrdering)
-
-
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 chooserpreferenceForLastSelectedDir
- Preference to use as the current directory in the file chooserselectionMode
- mode defined in GhidraFileChooser, e.g., GhidraFileChooser.FILES_ONLYallowMultiSelection
- true if multiple files can be selectedfilter
- filter to use; may be null if no filtering is required
-
addPath
Add a new file path and set its enablement- Parameters:
file
- the file whose path to useenabled
- true if enabled- Returns:
- true if the enabled path did not already exist
-
setPaths
-
clear
public void clear()Clear the paths in the table. -
addListener
-
removeListener
-
getListeners
-
getComponent
Returns the GUI component for the path manager.- Returns:
- the GUI component for the path manager
-
saveState
Saves the paths to the specified SaveState object.- Parameters:
ss
- the SaveState object
-
restoreFromPreferences
public void restoreFromPreferences(String enablePathKey, Path[] defaultEnablePaths, String disabledPathKey) Restore paths from user Preferences using the specified keys. If preferences have never been saved, the specifieddefaultEnablePaths
will be used. Note: the encoded path list must have been stored using the same keys using thesavePathsToPreferences(String, String, Path[])
orsaveToPreferences(String, String)
methods.- Parameters:
enablePathKey
- preference key for storing enabled pathsdefaultEnablePaths
- default pathsdisabledPathKey
- preference key for storing disabled paths
-
getPathsFromPreferences
public static Path[] getPathsFromPreferences(String enablePathKey, Path[] defaultEnablePaths, String disabledPathKey) Restore paths from user Preferences using the specified keys. If preferences have never been saved, the specifieddefaultEnablePaths
will be returned. Note: the encoded path list must have been stored using the same keys using thesavePathsToPreferences(String, String, Path[])
orsaveToPreferences(String, String)
methods.- Parameters:
enablePathKey
- preference key for storing enabled pathsdefaultEnablePaths
- default pathsdisabledPathKey
- preference key for storing disabled paths- Returns:
- ordered paths from Preferences
-
saveToPreferences
-
savePathsToPreferences
public static boolean savePathsToPreferences(String enablePathKey, String disabledPathKey, Path[] paths) Save the specified paths to the user Preferences using the specified keys. Note: The encoded path Preferences are intended to be decoded by therestoreFromPreferences(String, Path[], String)
andgetPathsFromPreferences(String, Path[], String)
methods.- Parameters:
enablePathKey
- preference key for storing enabled pathsdisabledPathKey
- preference key for storing disabled pathspaths
- paths to be saved- Returns:
- true if Preference saved properly
-
restoreState
Restores the paths from the specified SaveState object.- Parameters:
ss
- the SaveState object
-
dispose
public void dispose()
-