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
|
package com.ibm.ServerWizard2.view;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wb.swt.SWTResourceManager;
public class PasswordPrompt extends Dialog {
private Text text;
public char passwd[];
private String label = "REPO";
Button btnOk;
/**
* Create the dialog.
* @param parentShell
*/
public PasswordPrompt(Shell parentShell,String label) {
super(parentShell);
setShellStyle(SWT.APPLICATION_MODAL);
this.label = label;
}
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Label lblEnterPasswordFor = new Label(container, SWT.NONE);
lblEnterPasswordFor.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
GridData gd_lblEnterPasswordFor = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_lblEnterPasswordFor.widthHint = 352;
gd_lblEnterPasswordFor.heightHint = 21;
lblEnterPasswordFor.setLayoutData(gd_lblEnterPasswordFor);
lblEnterPasswordFor.setText("Enter Password For:");
Label lblRepository = new Label(container, SWT.NONE);
lblRepository.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
GridData gd_lblRepository = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_lblRepository.widthHint = 419;
gd_lblRepository.heightHint = 20;
lblRepository.setLayoutData(gd_lblRepository);
lblRepository.setText(label);
Composite composite_1 = new Composite(container, SWT.NONE);
GridData gd_composite_1 = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_composite_1.widthHint = 418;
gd_composite_1.heightHint = 38;
composite_1.setLayoutData(gd_composite_1);
text = new Text(composite_1, SWT.BORDER | SWT.PASSWORD);
text.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
text.setBounds(10, 10, 115, 21);
btnOk = new Button(composite_1, SWT.NONE);
btnOk.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
btnOk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
passwd = text.getTextChars();
close();
}
});
btnOk.setBounds(143, 6, 75, 25);
btnOk.setText("Ok");
this.getShell().setDefaultButton(btnOk);
return container;
}
/**
* Create contents of the button bar.
* @param parent
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
}
/**
* Return the initial size of the dialog.
*/
@Override
protected Point getInitialSize() {
return new Point(447, 174);
}
}
|