/**
   * Determines whether the file should be selected.
   *
   * @param fileInfo The file selection information.
   * @return true if the file should be selected, false otherwise.
   */
  public boolean accept(final FileSelectInfo fileInfo) {
    if (fileFilter != null) {
      return fileFilter.accept(fileInfo);
    }

    throw new IllegalArgumentException(
        Messages.getString("vfs.selectors/filefilter.missing.error"));
  }
Exemplo n.º 2
0
  private FilesCache getCache() {
    FilesCache files;
    // if (this.files == null)
    // {
    files = getContext().getFileSystemManager().getFilesCache();
    if (files == null) {
      throw new RuntimeException(Messages.getString("vfs.provider/files-cache-missing.error"));
    }
    // }

    return files;
  }
Exemplo n.º 3
0
  /** Fires an event. */
  private void fireEvent(final AbstractFileChangeEvent event) {
    FileListener[] fileListeners = null;
    final FileObject file = event.getFile();

    synchronized (listenerMap) {
      final ArrayList<?> listeners = listenerMap.get(file.getName());
      if (listeners != null) {
        fileListeners = listeners.toArray(new FileListener[listeners.size()]);
      }
    }

    if (fileListeners != null) {
      for (final FileListener fileListener : fileListeners) {
        try {
          event.notify(fileListener);
        } catch (final Exception e) {
          final String message = Messages.getString("vfs.provider/notify-listener.warn", file);
          // getLogger().warn(message, e);
          VfsLog.warn(getLogger(), LOG, message, e);
        }
      }
    }
  }