Package ghidra.framework.store
Class FileSystemEventManager
java.lang.Object
ghidra.framework.store.FileSystemEventManager
- All Implemented Interfaces:
FileSystemListener
FileSystemListenerList
maintains a list of FileSystemListener's.
This class, acting as a FileSystemListener, simply relays each callback to
all FileSystemListener's within its list. Employs either a synchronous
and asynchronous notification mechanism. Once disposed event dispatching will
discontinue.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(FileSystemListener listener) Add a listener to this list.void
dispose()
Discontinue event dispatching and terminate dispatch thread if it exists.boolean
flushEvents
(long timeout, TimeUnit unit) Blocks until all current events have been processed.void
folderCreated
(String parentPath, String folderName) Notification that a new folder was created.void
folderDeleted
(String parentPath, String folderName) Notification that a folder was deleted.void
folderMoved
(String parentPath, String folderName, String newParentPath) Notification that a folder was moved.void
folderRenamed
(String parentPath, String folderName, String newFolderName) Notification that a folder was renamed.boolean
Return true if asynchornous event processing is enabled.void
itemChanged
(String parentPath, String itemName) Notfication that an item's state has changed.void
itemCreated
(String parentPath, String itemName) Notification that a new folder item was created.void
itemDeleted
(String parentPath, String itemName) Notification that a folder item was deleted.void
Notification that an item was moved.void
itemRenamed
(String parentPath, String itemName, String newName) Notification that an item was renamed.void
remove
(FileSystemListener listener) Remove a listener from this list.void
Perform a full refresh / synchronization
-
Constructor Details
-
FileSystemEventManager
public FileSystemEventManager(boolean enableAsynchronousDispatching) Constructor- Parameters:
enableAsynchronousDispatching
- if true a separate dispatch thread will be used to notify listeners. If false, blocking notification will be performed. Events are immediately discarded in the absence of any listener(s).
-
-
Method Details
-
isAsynchronous
public boolean isAsynchronous()Return true if asynchornous event processing is enabled.- Returns:
- true if asynchornous event processing is enabled, else false
-
dispose
public void dispose()Discontinue event dispatching and terminate dispatch thread if it exists. -
add
Add a listener to this list.- Parameters:
listener
- the listener
-
remove
Remove a listener from this list.- Parameters:
listener
- the listener
-
itemMoved
Description copied from interface:FileSystemListener
Notification that an item was moved.- Specified by:
itemMoved
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that used to contain the item.name
- the name of the item that was moved.newParentPath
- the path of the folder that the item was moved to.newName
- the new name of the item.
-
itemRenamed
Description copied from interface:FileSystemListener
Notification that an item was renamed.- Specified by:
itemRenamed
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that contains the renamed itemitemName
- the old name of the item.newName
- the new name of the item.
-
itemDeleted
Description copied from interface:FileSystemListener
Notification that a folder item was deleted.- Specified by:
itemDeleted
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that contained the deleted item.itemName
- the name of the item that was deleted.
-
folderRenamed
Description copied from interface:FileSystemListener
Notification that a folder was renamed.- Specified by:
folderRenamed
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder containing the folder that was renamed.folderName
- the old name of the folder.newFolderName
- the new name of the folder.
-
folderMoved
Description copied from interface:FileSystemListener
Notification that a folder was moved.- Specified by:
folderMoved
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that used to contain the moved folder.folderName
- the name of the folder that was moved.newParentPath
- the path of the folder that now contains the moved folder.
-
folderDeleted
Description copied from interface:FileSystemListener
Notification that a folder was deleted.- Specified by:
folderDeleted
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that contained the deleted folder.folderName
- the name of the folder that was deleted.
-
itemCreated
Description copied from interface:FileSystemListener
Notification that a new folder item was created.- Specified by:
itemCreated
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that contains the new item.itemName
- the name of the new item.
-
folderCreated
Description copied from interface:FileSystemListener
Notification that a new folder was created.- Specified by:
folderCreated
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder that contains the new folderfolderName
- the name of the new folder
-
itemChanged
Description copied from interface:FileSystemListener
Notfication that an item's state has changed.- Specified by:
itemChanged
in interfaceFileSystemListener
- Parameters:
parentPath
- the path of the folder containing the item.itemName
- the name of the item that has changed.
-
syncronize
public void syncronize()Description copied from interface:FileSystemListener
Perform a full refresh / synchronization- Specified by:
syncronize
in interfaceFileSystemListener
-
flushEvents
Blocks until all current events have been processed.Note: clients should only use this method when
isAsynchronous()
returns true, since this class cannot track when non-threaded events have finished broadcasting to listeners. In a synchronous use case, any test that needs to know when client events have been processed must use some other mechanism to know when event processing is finished.- Parameters:
timeout
- the maximum time to waitunit
- the time unit of thetime
argument- Returns:
- true if the events were processed in the given timeout. A false value will be returned if either a timeout occured
-