-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUFSettings.pas
180 lines (141 loc) · 4.01 KB
/
UFSettings.pas
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
unit UFSettings;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
System.ImageList, Vcl.ImgList, System.Win.Registry;
type
TFSettings = class(TForm)
FileOpenDialog: TFileOpenDialog;
ImageList1: TImageList;
Panel1: TPanel;
BOK: TButton;
Button1: TButton;
GroupBox1: TGroupBox;
RBJava2OP: TRadioButton;
RbJavaImport: TRadioButton;
BEJ2OPath: TButtonedEdit;
BEJIPath: TButtonedEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BEJDKHome: TButtonedEdit;
Label4: TLabel;
BEBuildToolsPath: TButtonedEdit;
procedure BEJ2OPathRightButtonClick(Sender: TObject);
procedure BEJIPathRightButtonClick(Sender: TObject);
procedure BOKClick(Sender: TObject);
procedure BEJDKHomeRightButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FSettings: TFSettings;
implementation
uses
UFGetJars;
{$R *.dfm}
procedure TFSettings.BEJ2OPathRightButtonClick(Sender: TObject);
begin
if FileOpenDialog.Execute
then
begin
BEJ2OPath.Text := FileOpenDialog.FileName;
end;
end;
procedure TFSettings.BEJDKHomeRightButtonClick(Sender: TObject);
begin
if FileOpenDialog.Execute
then
begin
BEJDKHome.Text := FileOpenDialog.FileName;
end;
end;
procedure TFSettings.BEJIPathRightButtonClick(Sender: TObject);
begin
if FileOpenDialog.Execute
then
begin
BEJIPath.Text := FileOpenDialog.FileName;
end;
end;
procedure TFSettings.BOKClick(Sender: TObject);
begin
if RBJava2OP.Checked
then
begin
if BEJ2OPath.Text = ''
then
begin
ShowMessage('Please enter path to Java2OP.exe');
BEJ2OPath.SetFocus;
Exit;
end;
if not FileExists(BEJ2OPath.Text + '\java2op.exe')
then
begin
ShowMessage('File ' + BEJIPath.Text + '\java2op.exe does not exist');
BEJ2OPath.SetFocus;
Exit;
end;
end
else
begin
if BEJIPath.Text = ''
then
begin
ShowMessage('Please enter path to javaimport.exe');
BEJIPath.SetFocus;
Exit;
end;
if not FileExists(BEJIPath.Text + '\javaimport.exe')
then
begin
ShowMessage('File ' + BEJIPath.Text + '\javaimport.exe does not exist');
BEJIPath.SetFocus;
Exit;
end;
end;
if BEJDKHome.Text = ''
then
begin
ShowMessage('Please enter path to JDK');
BEJDKHome.SetFocus;
Exit;
end;
if not DirectoryExists(BEJDKHome.Text)
then
begin
ShowMessage('Directory ' + BEJDKHome.Text + ' does not exist');
BEJDKHome.SetFocus;
Exit;
end;
if BEBuildToolsPath.Text = ''
then
begin
ShowMessage('Please enter path to Build Tools');
BEBuildToolsPath.SetFocus;
Exit;
end;
if not DirectoryExists(BEBuildToolsPath.Text)
then
begin
ShowMessage('Directory ' + BEBuildToolsPath.Text + ' does not exist');
BEBuildToolsPath.SetFocus;
Exit;
end;
with TRegIniFile.Create(REG_KEY) do
try
WriteString(REG_BUILD_OPTIONS, 'Java2op Location', BEJ2OPath.Text);
WriteString(REG_BUILD_OPTIONS, 'JavaImport Location', BEJIPath.Text);
WriteString(REG_BUILD_OPTIONS, 'JDK Location', BEJDKHome.Text);
WriteString(REG_BUILD_OPTIONS, 'Build Tools Location', BEBuildToolsPath.Text);
WriteBool(REG_BUILD_OPTIONS, 'Java2OP', RBJava2OP.Checked);
finally
Free;
end;
ModalResult := mrOK;
end;
end.