1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.aequo.text;
14
15 import java.io.File;
16 import java.io.IOException;
17
18 import org.abstracthorizon.aequo.GlobalContext;
19 import org.abstracthorizon.aequo.file.BaseFileCompareWindow;
20 import org.abstracthorizon.aequo.file.FileCompareEntry;
21
22
23
24
25
26
27 public class TextCompareWindow extends BaseFileCompareWindow {
28
29
30 protected TextModel model;
31
32
33
34
35
36
37
38
39 public TextCompareWindow(GlobalContext context, File leftFile, File rightFile) throws IOException {
40 super(context);
41
42 model = new TextModel(leftFile, rightFile);
43 model.load();
44 }
45
46
47
48
49
50 protected String getWindowId() {
51 return "window.text";
52 }
53
54
55
56
57 public void initialise() {
58 super.initialise();
59 }
60
61
62
63
64 protected void createComparePanel() {
65 comparePanel = new TextComparePanel(context, model);
66 comparePanel.initialise();
67 }
68
69
70
71
72
73
74
75 public TextCompareWindow(GlobalContext context, FileCompareEntry fileEntry) throws IOException {
76 super(context);
77
78 model = new TextModel(fileEntry);
79 model.load();
80 }
81
82
83
84
85
86 protected String getLeftFileName() {
87 return model.getLeftFile().getAbsolutePath();
88 }
89
90
91
92
93
94 protected String getRightFileName() {
95 return model.getRightFile().getAbsolutePath();
96 }
97
98
99
100
101
102 public void setTitle(String title) {
103 if (getLeftFileName().equals(getRightFileName())) {
104 super.setTitle(getLeftFileName() + ": " + title);
105 } else {
106 super.setTitle(title);
107 }
108 }
109 }