Ejemplo n.º 1
0
  /**
   * Inserts a file into the specified buffer. The default implementation posts an I/O request to
   * the I/O thread.
   *
   * @param view The view
   * @param buffer The buffer
   * @param path The path
   */
  public boolean insert(View view, Buffer buffer, String path) {
    if ((getCapabilities() & READ_CAP) == 0) {
      VFSManager.error(view, path, "vfs.not-supported.load", new String[] {name});
      return false;
    }

    Object session = createVFSSession(path, view);
    if (session == null) return false;

    VFSManager.runInWorkThread(new BufferInsertRequest(view, buffer, session, this, path));
    return true;
  } // }}}
Ejemplo n.º 2
0
  /**
   * Saves the specifies buffer. The default implementation posts an I/O request to the I/O thread.
   *
   * @param view The view
   * @param buffer The buffer
   * @param path The path
   */
  public boolean save(View view, Buffer buffer, String path) {
    if ((getCapabilities() & WRITE_CAP) == 0) {
      VFSManager.error(view, path, "vfs.not-supported.save", new String[] {name});
      return false;
    }

    Object session = createVFSSession(path, view);
    if (session == null) return false;

    /* When doing a 'save as', the path to save to (path)
     * will not be the same as the buffer's previous path
     * (buffer.getPath()). In that case, we want to create
     * a backup of the new path, even if the old path was
     * backed up as well (BACKED_UP property set) */
    if (!path.equals(buffer.getPath())) buffer.unsetProperty(Buffer.BACKED_UP);

    VFSManager.runInWorkThread(new BufferSaveRequest(view, buffer, session, this, path));
    return true;
  } // }}}
Ejemplo n.º 3
0
  /**
   * Loads the specified buffer. The default implementation posts an I/O request to the I/O thread.
   *
   * @param view The view
   * @param buffer The buffer
   * @param path The path
   */
  public boolean load(View view, Buffer buffer, String path) {
    if ((getCapabilities() & READ_CAP) == 0) {
      VFSManager.error(view, path, "vfs.not-supported.load", new String[] {name});
      return false;
    }

    Object session = createVFSSession(path, view);
    if (session == null) return false;

    if ((getCapabilities() & WRITE_CAP) == 0) buffer.setReadOnly(true);

    BufferIORequest request = new BufferLoadRequest(view, buffer, session, this, path);
    if (buffer.isTemporary())
      // this makes HyperSearch much faster
      request.run();
    else VFSManager.runInWorkThread(request);

    return true;
  } // }}}