Package docking.widgets.pathmanager
Class PathManager
- java.lang.Object
-
- docking.widgets.pathmanager.PathManager
-
public class PathManager extends java.lang.ObjectComponent 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
Constructors Constructor Description PathManager(boolean addToTop, boolean allowOrdering)PathManager(java.util.List<Path> paths, boolean addToTop, boolean allowOrdering)Construct a new PathnameTablePanel.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(PathManagerListener listener)booleanaddPath(ResourceFile file, boolean enabled)Add a new file path and set its enablementvoidclear()Clear the paths in the table.voiddispose()javax.swing.JComponentgetComponent()Returns the GUI component for the path manager.java.util.List<PathManagerListener>getListeners()java.util.List<Path>getPaths()Return enabled paths in the table.static Path[]getPathsFromPreferences(java.lang.String enablePathKey, Path[] defaultEnablePaths, java.lang.String disabledPathKey)voidremoveListener(PathManagerListener listener)voidrestoreFromPreferences(java.lang.String enablePathKey, Path[] defaultEnablePaths, java.lang.String disabledPathKey)voidrestoreState(SaveState ss)Restores the paths from the specified SaveState object.static booleansavePathsToPreferences(java.lang.String enablePathKey, java.lang.String disabledPathKey, Path[] paths)voidsaveState(SaveState ss)Saves the paths to the specified SaveState object.booleansaveToPreferences(java.lang.String enablePathKey, java.lang.String disabledPathKey)voidsetFileChooserProperties(java.lang.String title, java.lang.String preferenceForLastSelectedDir, GhidraFileChooserMode selectionMode, boolean allowMultiSelection, GhidraFileFilter filter)Set properties on the file chooser that is displayed when the "Add" button is pressed.voidsetPaths(java.util.List<Path> paths)Set the paths.
-
-
-
Constructor Detail
-
PathManager
public PathManager(java.util.List<Path> paths, boolean addToTop, boolean allowOrdering)
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 Detail
-
setFileChooserProperties
public void setFileChooserProperties(java.lang.String title, java.lang.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
-
getPaths
public java.util.List<Path> getPaths()
Return enabled paths in the table.
-
addPath
public boolean addPath(ResourceFile file, boolean enabled)
Add a new file path and set its enablement- Parameters:
file-enabled-
-
setPaths
public void setPaths(java.util.List<Path> paths)
Set the paths.
-
clear
public void clear()
Clear the paths in the table.
-
addListener
public void addListener(PathManagerListener listener)
-
removeListener
public void removeListener(PathManagerListener listener)
-
getListeners
public java.util.List<PathManagerListener> getListeners()
-
getComponent
public javax.swing.JComponent getComponent()
Returns the GUI component for the path manager.- Returns:
- the GUI component for the path manager
-
saveState
public void saveState(SaveState ss)
Saves the paths to the specified SaveState object.- Parameters:
ss- the SaveState object
-
restoreFromPreferences
public void restoreFromPreferences(java.lang.String enablePathKey, Path[] defaultEnablePaths, java.lang.String disabledPathKey)
-
getPathsFromPreferences
public static Path[] getPathsFromPreferences(java.lang.String enablePathKey, Path[] defaultEnablePaths, java.lang.String disabledPathKey)
-
saveToPreferences
public boolean saveToPreferences(java.lang.String enablePathKey, java.lang.String disabledPathKey)
-
savePathsToPreferences
public static boolean savePathsToPreferences(java.lang.String enablePathKey, java.lang.String disabledPathKey, Path[] paths)
-
restoreState
public void restoreState(SaveState ss)
Restores the paths from the specified SaveState object.- Parameters:
ss- the SaveState object
-
dispose
public void dispose()
-
-