8
8
import org .apache .hop .ui .core .metadata .MetadataEditor ;
9
9
import org .apache .hop .ui .core .metadata .MetadataManager ;
10
10
import org .apache .hop .ui .core .widget .ComboVar ;
11
+ import org .apache .hop .ui .core .widget .LabelTextVar ;
11
12
import org .apache .hop .ui .core .widget .PasswordTextVar ;
12
13
import org .apache .hop .ui .core .widget .TextVar ;
13
14
import org .apache .hop .ui .hopgui .HopGui ;
14
15
import org .apache .hop .ui .hopgui .perspective .metadata .MetadataPerspective ;
15
16
import org .eclipse .swt .SWT ;
17
+ import org .eclipse .swt .events .SelectionAdapter ;
18
+ import org .eclipse .swt .events .SelectionEvent ;
16
19
import org .eclipse .swt .layout .FormAttachment ;
17
20
import org .eclipse .swt .layout .FormData ;
18
21
import org .eclipse .swt .widgets .Button ;
@@ -50,6 +53,12 @@ public class MailServerConnectionEditor extends MetadataEditor<MailServerConnect
50
53
51
54
private ComboVar wConnectionProtocol ;
52
55
56
+ private Button wCheckServerIdentity ;
57
+
58
+ private Label wlCheckServerIdentity ;
59
+
60
+ private LabelTextVar wTrustedHosts ;
61
+
53
62
public MailServerConnectionEditor (
54
63
HopGui hopGui , MetadataManager <MailServerConnection > manager , MailServerConnection metadata ) {
55
64
super (hopGui , manager , metadata );
@@ -82,6 +91,28 @@ public void createControl(Composite composite) {
82
91
wName .setLayoutData (fdName );
83
92
Control lastControl = wName ;
84
93
94
+ Label wlConnectionProtocol = new Label (composite , SWT .RIGHT );
95
+ PropsUi .setLook (wlConnectionProtocol );
96
+ wlConnectionProtocol .setText (
97
+ BaseMessages .getString (PKG , "MailServerConnectionDialog.ConnectionProtocol" ));
98
+ FormData fdlConnectionProtocol = new FormData ();
99
+ fdlConnectionProtocol .top = new FormAttachment (lastControl , margin );
100
+ fdlConnectionProtocol .left = new FormAttachment (0 , 0 );
101
+ fdlConnectionProtocol .right = new FormAttachment (middle , -margin );
102
+ wlConnectionProtocol .setLayoutData (fdlConnectionProtocol );
103
+ wConnectionProtocol = new ComboVar (variables , composite , SWT .SINGLE | SWT .BORDER );
104
+ PropsUi .setLook (wConnectionProtocol );
105
+ FormData fdConnectionProtocol = new FormData ();
106
+ fdConnectionProtocol .top = new FormAttachment (lastControl , margin );
107
+ fdConnectionProtocol .left = new FormAttachment (middle , 0 );
108
+ fdConnectionProtocol .right = new FormAttachment (100 , 0 );
109
+ wConnectionProtocol .setLayoutData (fdConnectionProtocol );
110
+ lastControl = wConnectionProtocol ;
111
+
112
+ String [] protocols = new String [] {"SMTP" , "IMAP" , "POP3" , "MBOX" };
113
+ wConnectionProtocol .setItems (protocols );
114
+ wConnectionProtocol .select (1 );
115
+
85
116
Label wlServerHostLabel = new Label (composite , SWT .RIGHT );
86
117
PropsUi .setLook (wlServerHostLabel );
87
118
wlServerHostLabel .setText (BaseMessages .getString (PKG , "MailServerConnectionDialog.ServerHost" ));
@@ -221,8 +252,48 @@ public void createControl(Composite composite) {
221
252
fdSecureConnectionType .left = new FormAttachment (middle , 0 );
222
253
fdSecureConnectionType .right = new FormAttachment (100 , 0 );
223
254
wSecureConnectionType .setLayoutData (fdSecureConnectionType );
255
+ String [] secureConnectionType = new String [] {"SSL" , "TLS" , "TLS 1.2" };
224
256
lastControl = wSecureConnectionType ;
225
257
258
+ // Use check server identity
259
+ wlCheckServerIdentity = new Label (composite , SWT .RIGHT );
260
+ wlCheckServerIdentity .setText (
261
+ BaseMessages .getString (PKG , "ActionMail.CheckServerIdentity.Label" ));
262
+ PropsUi .setLook (wlCheckServerIdentity );
263
+ FormData fdlCheckServerIdentity = new FormData ();
264
+ fdlCheckServerIdentity .left = new FormAttachment (0 , 0 );
265
+ fdlCheckServerIdentity .top = new FormAttachment (lastControl , 2 * margin );
266
+ fdlCheckServerIdentity .right = new FormAttachment (middle , -margin );
267
+ wlCheckServerIdentity .setLayoutData (fdlCheckServerIdentity );
268
+ wCheckServerIdentity = new Button (composite , SWT .CHECK );
269
+ PropsUi .setLook (wCheckServerIdentity );
270
+ FormData fdCheckServerIdentity = new FormData ();
271
+ fdCheckServerIdentity .left = new FormAttachment (middle , margin );
272
+ fdCheckServerIdentity .top = new FormAttachment (lastControl , 0 , SWT .CENTER );
273
+ fdCheckServerIdentity .right = new FormAttachment (100 , 0 );
274
+ wCheckServerIdentity .setLayoutData (fdCheckServerIdentity );
275
+ wCheckServerIdentity .addSelectionListener (
276
+ new SelectionAdapter () {
277
+ @ Override
278
+ public void widgetSelected (SelectionEvent e ) {
279
+ setChanged ();
280
+ }
281
+ });
282
+
283
+ // Trusted Hosts line
284
+ wTrustedHosts =
285
+ new LabelTextVar (
286
+ variables ,
287
+ composite ,
288
+ BaseMessages .getString (PKG , "ActionMail.TrustedHosts.Label" ),
289
+ BaseMessages .getString (PKG , "ActionMail.TrustedHosts.Tooltip" ));
290
+ // wTrustedHosts.addModifyListener(lsMod);
291
+ FormData fdTrustedHosts = new FormData ();
292
+ fdTrustedHosts .left = new FormAttachment (0 , 0 );
293
+ fdTrustedHosts .top = new FormAttachment (lastControl , 2 * margin );
294
+ fdTrustedHosts .right = new FormAttachment (100 , 0 );
295
+ wTrustedHosts .setLayoutData (fdTrustedHosts );
296
+
226
297
Label wlUseProxy = new Label (composite , SWT .RIGHT );
227
298
PropsUi .setLook (wlUseProxy );
228
299
wlUseProxy .setText (BaseMessages .getString (PKG , "MailServerConnectionDialog.UseProxy" ));
@@ -276,28 +347,6 @@ public void createControl(Composite composite) {
276
347
wProxyPassword .setLayoutData (fdProxyPassword );
277
348
lastControl = wProxyPassword ;
278
349
279
- Label wlConnectionProtocol = new Label (composite , SWT .RIGHT );
280
- PropsUi .setLook (wlConnectionProtocol );
281
- wlConnectionProtocol .setText (
282
- BaseMessages .getString (PKG , "MailServerConnectionDialog.ConnectionProtocol" ));
283
- FormData fdlConnectionProtocol = new FormData ();
284
- fdlConnectionProtocol .top = new FormAttachment (lastControl , margin );
285
- fdlConnectionProtocol .left = new FormAttachment (0 , 0 );
286
- fdlConnectionProtocol .right = new FormAttachment (middle , -margin );
287
- wlConnectionProtocol .setLayoutData (fdlConnectionProtocol );
288
- wConnectionProtocol = new ComboVar (variables , composite , SWT .SINGLE | SWT .BORDER );
289
- PropsUi .setLook (wConnectionProtocol );
290
- FormData fdConnectionProtocol = new FormData ();
291
- fdConnectionProtocol .top = new FormAttachment (lastControl , margin );
292
- fdConnectionProtocol .left = new FormAttachment (middle , 0 );
293
- fdConnectionProtocol .right = new FormAttachment (100 , 0 );
294
- wConnectionProtocol .setLayoutData (fdConnectionProtocol );
295
- lastControl = wConnectionProtocol ;
296
-
297
- String [] protocols = new String [] {"SMTP" , "IMAP" , "POP3" , "MBOX" };
298
- wConnectionProtocol .setItems (protocols );
299
- wConnectionProtocol .select (1 );
300
-
301
350
setWidgetsContent ();
302
351
303
352
resetChanged ();
@@ -353,6 +402,8 @@ public void setWidgetsContent() {
353
402
wUseSecureAuthentication .setSelection (metadata .isUseSecureAuthentication ());
354
403
wSecureConnectionType .setText (Const .NVL (metadata .getSecureConnectionType (), "" ));
355
404
wUseProxy .setSelection (metadata .isUseProxy ());
405
+ wTrustedHosts .setText (Const .NVL (metadata .getTrustedHosts (), "" ));
406
+ wCheckServerIdentity .setSelection (wCheckServerIdentity .getSelection ());
356
407
wProxyUsername .setText (Const .NVL (metadata .getProxyUsername (), "" ));
357
408
wConnectionProtocol .setText (Const .NVL (metadata .getProtocol (), "" ));
358
409
}
@@ -369,11 +420,13 @@ public void getWidgetsContent(MailServerConnection connection) {
369
420
connection .setPassword (wServerPassword .getText ());
370
421
connection .setUseSecureAuthentication (wUseSecureAuthentication .getSelection ());
371
422
connection .setSecureConnectionType (wSecureConnectionType .getText ());
423
+ connection .setTrustedHosts (wTrustedHosts .getText ());
424
+ connection .setCheckServerIdentity (wCheckServerIdentity .getSelection ());
372
425
connection .setUseProxy (wUseProxy .getSelection ());
373
426
connection .setProxyUsername (wProxyUsername .getText ());
374
427
}
375
428
376
- public void testConnection () {
429
+ private void testConnection () {
377
430
MailServerConnection connection = new MailServerConnection (getVariables ());
378
431
connection .setName (wName .getText ());
379
432
connection .setProtocol (wConnectionProtocol .getText ());
0 commit comments