CopyFileWorker (jEdit API Documentation)

Package org.gjt.sp.jedit.io

## Class CopyFileWorker

- java.lang.Object
- - org.gjt.sp.util.Task
  - - org.gjt.sp.jedit.io.CopyFileWorker

- All Implemented Interfaces:
    `java.lang.Runnable`, `ProgressObserver`

      public class CopyFileWorker
      extends Task

  This worker will copy a file. Be careful it override files if the target already exists
  Since:
    jEdit 4.3pre13

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `CopyFileWorker.Behavior` | The behavior if the target already exists

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CopyFileWorker​(java.awt.Component comp, java.lang.String source, java.lang.String target)` | Copy a file.
    `CopyFileWorker​(java.awt.Component comp, java.util.List<java.lang.String> sources, java.lang.String target)` | Copy all files from the list to the target directory.
    `CopyFileWorker​(java.awt.Component comp, java.util.List<java.lang.String> sources, java.lang.String target, CopyFileWorker.Behavior behavior)` | Copy all files from the list to the target directory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `_run()` | This is the method you have to implement and that will be executed in the thread.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class org.gjt.sp.util.Task

      `cancel, getLabel, getMaximum, getState, getStatus, getValue, isCancellable, run, setCancellable, setLabel, setMaximum, setStatus, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CopyFileWorker

          public CopyFileWorker​(java.awt.Component comp,
                                java.lang.String source,
                                java.lang.String target)

      Copy a file. Careful, it will overwrite the target.
      Parameters:
        `comp` - the component that will be used as parent in case of error
        `source` - the source path
        `target` - the target path (it is the file path, not a parent directory)

    - #### CopyFileWorker

          public CopyFileWorker​(java.awt.Component comp,
                                java.util.List<java.lang.String> sources,
                                java.lang.String target)

      Copy all files from the list to the target directory. If some files already exist in the target directory the files will be skipped.
      Parameters:
        `comp` - the component that will be used as parent in case of error
        `sources` - the sources path to copy
        `target` - the target path (it must be a directory otherwise nothing will be copied)
      Since:
        jEdit 5.0

    - #### CopyFileWorker

          public CopyFileWorker​(java.awt.Component comp,
                                @Nonnull
                                java.util.List<java.lang.String> sources,
                                @Nonnull
                                java.lang.String target,
                                CopyFileWorker.Behavior behavior)

      Copy all files from the list to the target directory. If some files already exist in the target directory the `Behavior` will decide what to do.
      Parameters:
        `comp` - the component that will be used as parent in case of error
        `sources` - the sources path to copy
        `target` - the target path (it must be a directory otherwise nothing will be copied)
        `behavior` - the behavior if the target file already exists
      Since:
        jEdit 5.0

  - ### Method Detail

    - #### _run

          public void _run()

      Description copied from class: `Task`
      This is the method you have to implement and that will be executed in the thread.
      Specified by:
        `_run` in class `Task`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `Task`