-
Notifications
You must be signed in to change notification settings - Fork 0
/
CopyThread.java
47 lines (38 loc) · 1.31 KB
/
CopyThread.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.awt.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
@Deprecated
public class CopyThread extends Thread {
@Override
public void run() {
super.run();
int size = FileListAction.fileList.size();
String labelText = "files: 1 " + "of " + size;
String fieldText = "Copy started at " + new Date() + "\n";
synchronized (new ProgressDialog("Copy", labelText, fieldText)){
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Path destDir = Paths.get(MainPanel.destPath);
int i = 1;
for (Path entry : FileListAction.fileList) {
ProgressDialog.copyLabel.setText("Copy files: " + i + " of " + size);
i++;
ProgressDialog.textField.append(entry.toString() + "\n");
System.out.println(ProgressDialog.textField.getText());
try {
Files.copy(entry, destDir.resolve(entry.getFileName()));
}
catch (IOException e1) {
System.err.println(e1);
}
}
FileListAction.fileList.clear();
}
}