1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.aequo.file;
14
15 import java.io.File;
16
17 import org.abstracthorizon.aequo.GlobalContext;
18 import org.abstracthorizon.aequo.gui.InputFolders;
19 import org.abstracthorizon.aequo.util.TaskUtilities;
20 import org.abstracthorizon.aequo.util.filters.Filter;
21
22
23
24
25
26
27 public class FileCompareWindow extends BaseFileCompareWindow {
28
29
30 protected FilesModel model;
31
32
33
34
35
36
37
38
39 public FileCompareWindow(GlobalContext context, File leftFile, File rightFile, Filter filter) {
40 super(context);
41
42 if (filter == null) {
43 filter = new Filter();
44 }
45 model = new FilesModel(leftFile, rightFile, filter);
46 }
47
48
49
50
51
52 protected String getWindowId() {
53 return "window.file";
54 }
55
56
57
58
59 public void initialise() {
60 InputFolders.addNewSession(context.getPreferences(), model.getData(0), model.getData(1), model.getFilter());
61 super.initialise();
62 model.addRefreshListener(new FilesModel.RefreshListener() {
63
64 public void currentlyProcessing(FileCompareEntry entry) {
65 if (entry != null) {
66 StringBuffer path = new StringBuffer();
67 while (entry != null) {
68 if (path.length() > 0) {
69 path.insert(0, '/');
70 }
71 path.insert(0, entry.getData()[0].getName());
72 entry = entry.parentEntry;
73 }
74 path.insert(0, "Processing: ");
75 ((TableFileComparePanel)comparePanel).bottomStatus.setText(path.toString());
76 } else {
77 ((TableFileComparePanel)comparePanel).bottomStatus.setText(" ");
78 }
79 }
80
81 });
82
83 TaskUtilities.invokeLater(new Runnable() {
84 public void run() {
85 Thread.yield();
86 model.refresh();
87 }
88 });
89 }
90
91
92
93
94 protected void createComparePanel() {
95 comparePanel = new TableFileComparePanel(context, model);
96 comparePanel.initialise();
97 }
98
99
100
101
102
103 protected String getLeftFileName() {
104 return model.getLeftFile().getAbsolutePath();
105 }
106
107
108
109
110
111 protected String getRightFileName() {
112 return model.getRightFile().getAbsolutePath();
113 }
114
115 }