1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.aequo.action;
14
15 import java.awt.event.ActionEvent;
16 import java.awt.event.ActionListener;
17 import java.io.File;
18
19 import javax.swing.AbstractAction;
20 import javax.swing.JFrame;
21
22 import org.abstracthorizon.aequo.GlobalContext;
23 import org.abstracthorizon.aequo.file.FileCompareWindow;
24 import org.abstracthorizon.aequo.util.filters.Filter;
25
26
27
28
29
30
31 public class CompareFilesAction extends AbstractAction implements ActionListener {
32
33
34 protected File left;
35
36
37 protected File right;
38
39
40 protected Filter filters;
41
42
43 protected GlobalContext context;
44
45
46 protected JFrame window;
47
48
49
50
51
52 public CompareFilesAction(GlobalContext context) {
53 this(context, null);
54 }
55
56
57
58
59
60
61 public CompareFilesAction(GlobalContext context, JFrame window) {
62 this.context = context;
63 this.window = window;
64 }
65
66
67
68
69
70
71
72
73 public CompareFilesAction(File left, File right, Filter filters, GlobalContext context) {
74 this(left, right, filters, context, null);
75 }
76
77
78
79
80
81
82
83
84
85 public CompareFilesAction(File left, File right, Filter filters, GlobalContext context, JFrame window) {
86 this.left = left;
87 this.right = right;
88 this.filters = filters;
89 this.context = context;
90 this.window = window;
91 }
92
93
94
95
96
97
98 public void actionPerformed(ActionEvent e) {
99 FileCompareWindow compareWindow = new FileCompareWindow(context, getLeft(), getRight(), getFilters());
100 compareWindow.initialise();
101 compareWindow.setVisible(true);
102 if (window != null) {
103 window.dispose();
104 }
105 }
106
107
108
109
110
111 protected File getLeft() {
112 return left;
113 }
114
115
116
117
118
119 protected File getRight() {
120 return right;
121 }
122
123
124
125
126
127 protected Filter getFilters() {
128 return filters;
129 }
130 }