public FolderChangeMonitor(FolderPanel folderPanel) {
    this.folderPanel = folderPanel;

    // Listen to folder changes to know when a folder is being / has been changed
    folderPanel.getLocationManager().addLocationListener(this);

    this.currentFolder = folderPanel.getCurrentFolder();
    this.currentFolderDate = currentFolder.getDate();

    // Folder contents is up-to-date let's wait before checking it for changes
    this.lastCheckTimestamp = System.currentTimeMillis();
    this.waitBeforeCheckTime = waitAfterRefresh;

    folderPanel.getMainFrame().addWindowListener(this);

    instances.add(this);

    // create and start the monitor thread on first FolderChangeMonitor instance
    if (monitorThread == null && checkPeriod >= 0) {
      monitorThread = new Thread(this, getClass().getName());
      monitorThread.setDaemon(true);
      monitorThread.start();
    }
  }
示例#2
0
 public void locationFailed(LocationEvent locationEvent) {
   updateTabLocation(folderPanel.getCurrentFolder().getURL());
 }