Exemple #1
0
  // {{{ print() method
  public static void print(final View view, final Buffer buffer, boolean selection) {
    job = getPrintJob(buffer.getPath());

    boolean header = jEdit.getBooleanProperty("print.header");
    boolean footer = jEdit.getBooleanProperty("print.footer");
    boolean lineNumbers = jEdit.getBooleanProperty("print.lineNumbers");
    boolean color = jEdit.getBooleanProperty("print.color");
    Font font = jEdit.getFontProperty("print.font");

    BufferPrintable printable =
        new BufferPrintable(job, format, view, buffer, font, header, footer, lineNumbers, color);
    job.setPrintable(printable);

    if (!job.printDialog(format)) return;

    savePrintSpec();

    printable.print();
  } // }}}
Exemple #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;
  } // }}}