public class FileRefresher extends java.lang.Object implements Disposable
Disposable.Parent
Constructor and Description |
---|
FileRefresher(boolean recursive,
long delay,
NotNullProducer<? extends ModalityState> producer) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
boolean |
isRecursive() |
void |
pause()
Pauses files refreshing.
|
void |
register(VirtualFile file)
Registers the specified file to watch and to refresh.
|
void |
start()
Starts files refreshing immediately.
|
protected void |
unwatch(java.lang.Object watcher)
Stops watching file, which was added before.
|
protected java.lang.Object |
watch(VirtualFile file,
boolean recursive)
Starts watching the specified file, which was added before.
|
public FileRefresher(boolean recursive, long delay, NotNullProducer<? extends ModalityState> producer)
recursive
- true
if files should be considered as rootsdelay
- an amount of seconds before refreshing filesproducer
- a provider for modality state that can be invoked on background threadjava.lang.IllegalArgumentException
- if the specified delay is not positivepublic boolean isRecursive()
true
if files should be considered as rootsprotected java.lang.Object watch(VirtualFile file, boolean recursive)
file
- a file to watchrecursive
- true
if a file should be considered as rootprotected void unwatch(java.lang.Object watcher)
watcher
- an object that allows to stop watching a filepublic final void register(VirtualFile file)
file
- a file to watch and to refreshpublic final void pause()
public final void start()
public void dispose()
Disposable
dispose
in interface Disposable