Lines 24-35
Link Here
|
24 |
import org.eclipse.swt.events.*; |
24 |
import org.eclipse.swt.events.*; |
25 |
import org.eclipse.swt.graphics.Image; |
25 |
import org.eclipse.swt.graphics.Image; |
26 |
import org.eclipse.swt.layout.GridData; |
26 |
import org.eclipse.swt.layout.GridData; |
|
|
27 |
import org.eclipse.swt.layout.GridLayout; |
27 |
import org.eclipse.swt.widgets.*; |
28 |
import org.eclipse.swt.widgets.*; |
28 |
import org.eclipse.ui.PlatformUI; |
29 |
import org.eclipse.ui.PlatformUI; |
29 |
|
30 |
|
30 |
public class StorageLoginDialog extends TitleAreaDialog { |
31 |
public class StorageLoginDialog extends TitleAreaDialog { |
31 |
|
32 |
|
32 |
private static final String DIALOG_SETTINGS_SECTION = "StorageLoginDialog"; //$NON-NLS-1$ |
33 |
private static final String DIALOG_SETTINGS_SECTION_NEW = "StorageLoginDialogNew"; //$NON-NLS-1$ |
|
|
34 |
private static final String DIALOG_SETTINGS_SECTION_OLD = "StorageLoginDialogOld"; //$NON-NLS-1$ |
35 |
|
33 |
private static final String HELP_ID = Activator.PLUGIN_ID + ".StorageLoginDialog"; //$NON-NLS-1$ |
36 |
private static final String HELP_ID = Activator.PLUGIN_ID + ".StorageLoginDialog"; //$NON-NLS-1$ |
34 |
|
37 |
|
35 |
private static final ImageDescriptor dlgImageDescriptor = ImageDescriptor.createFromFile(StorageLoginDialog.class, "/icons/storage/login_wiz.png"); //$NON-NLS-1$ |
38 |
private static final ImageDescriptor dlgImageDescriptor = ImageDescriptor.createFromFile(StorageLoginDialog.class, "/icons/storage/login_wiz.png"); //$NON-NLS-1$ |
Lines 69-77
Link Here
|
69 |
|
72 |
|
70 |
protected IDialogSettings getDialogBoundsSettings() { |
73 |
protected IDialogSettings getDialogBoundsSettings() { |
71 |
IDialogSettings settings = Activator.getDefault().getDialogSettings(); |
74 |
IDialogSettings settings = Activator.getDefault().getDialogSettings(); |
72 |
IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION); |
75 |
String settingsID = (confirmPassword) ? DIALOG_SETTINGS_SECTION_NEW : DIALOG_SETTINGS_SECTION_OLD; |
|
|
76 |
IDialogSettings section = settings.getSection(settingsID); |
73 |
if (section == null) |
77 |
if (section == null) |
74 |
section = settings.addNewSection(DIALOG_SETTINGS_SECTION); |
78 |
section = settings.addNewSection(settingsID); |
75 |
return section; |
79 |
return section; |
76 |
} |
80 |
} |
77 |
|
81 |
|
Lines 81-104
Link Here
|
81 |
|
85 |
|
82 |
protected void configureShell(Shell shell) { |
86 |
protected void configureShell(Shell shell) { |
83 |
super.configureShell(shell); |
87 |
super.configureShell(shell); |
84 |
if (location == null) |
88 |
shell.setText(SecUIMessages.generalDialogTitle); |
85 |
shell.setText(passwordChange ? SecUIMessages.passwordChangeTitle : SecUIMessages.dialogTitle); |
|
|
86 |
else |
87 |
shell.setText(location); |
88 |
|
89 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, HELP_ID); |
89 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, HELP_ID); |
90 |
} |
90 |
} |
91 |
|
91 |
|
92 |
protected Control createContents(Composite parent) { |
92 |
protected Control createContents(Composite parent) { |
93 |
Control contents = super.createContents(parent); |
93 |
Control contents = super.createContents(parent); |
94 |
setMessage(passwordChange ? SecUIMessages.messageLoginChange : SecUIMessages.messageLogin); |
|
|
95 |
dlgTitleImage = dlgImageDescriptor.createImage(); |
94 |
dlgTitleImage = dlgImageDescriptor.createImage(); |
96 |
setTitleImage(dlgTitleImage); |
95 |
setTitleImage(dlgTitleImage); |
97 |
return contents; |
96 |
return contents; |
98 |
} |
97 |
} |
99 |
|
98 |
|
100 |
protected Control createDialogArea(Composite parent) { |
99 |
protected Control createDialogArea(Composite parent) { |
101 |
Composite composite = (Composite) super.createDialogArea(parent); |
100 |
Composite compositeTop = (Composite) super.createDialogArea(parent); |
|
|
101 |
|
102 |
String titleMsg; |
103 |
if (confirmPassword) |
104 |
titleMsg = SecUIMessages.passwordChangeTitle; |
105 |
else if (passwordChange) |
106 |
titleMsg = SecUIMessages.messageLoginChange; |
107 |
else |
108 |
titleMsg = SecUIMessages.dialogTitle; |
109 |
setTitle(titleMsg); |
110 |
|
111 |
Composite composite = new Composite(compositeTop, SWT.NONE); |
102 |
|
112 |
|
103 |
new Label(composite, SWT.LEFT).setText(SecUIMessages.labelPassword); |
113 |
new Label(composite, SWT.LEFT).setText(SecUIMessages.labelPassword); |
104 |
password = new Text(composite, SWT.LEFT | SWT.BORDER); |
114 |
password = new Text(composite, SWT.LEFT | SWT.BORDER); |
Lines 119-125
Link Here
|
119 |
} else |
129 |
} else |
120 |
confirm = null; |
130 |
confirm = null; |
121 |
|
131 |
|
122 |
showPassword = new Button(composite, SWT.CHECK); |
132 |
new Label(composite, SWT.LEFT); // filler |
|
|
133 |
showPassword = new Button(composite, SWT.CHECK | SWT.RIGHT); |
123 |
showPassword.setText(SecUIMessages.showPassword); |
134 |
showPassword.setText(SecUIMessages.showPassword); |
124 |
showPassword.addSelectionListener(new SelectionListener() { |
135 |
showPassword.addSelectionListener(new SelectionListener() { |
125 |
public void widgetSelected(SelectionEvent e) { |
136 |
public void widgetSelected(SelectionEvent e) { |
Lines 130-144
Link Here
|
130 |
passwordVisibility(); |
141 |
passwordVisibility(); |
131 |
} |
142 |
} |
132 |
}); |
143 |
}); |
|
|
144 |
showPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); |
133 |
|
145 |
|
134 |
// by default don't display password as clear text |
146 |
// by default don't display password as clear text |
135 |
showPassword.setSelection(false); |
147 |
showPassword.setSelection(false); |
136 |
passwordVisibility(); |
148 |
passwordVisibility(); |
137 |
|
149 |
|
|
|
150 |
if (location != null) { |
151 |
Group locationGroup = new Group(composite, SWT.NONE); |
152 |
locationGroup.setText(SecUIMessages.locationGroup); |
153 |
GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true); |
154 |
groupData.horizontalSpan = 2; |
155 |
locationGroup.setLayoutData(groupData); |
156 |
locationGroup.setLayout(new GridLayout()); |
157 |
|
158 |
Label locationLabel = new Label(locationGroup, SWT.WRAP); |
159 |
locationLabel.setText(location); |
160 |
} |
161 |
|
138 |
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
162 |
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
139 |
GridLayoutFactory.swtDefaults().generateLayout(composite); |
163 |
GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(composite); |
140 |
|
164 |
|
141 |
return composite; |
165 |
return compositeTop; |
142 |
} |
166 |
} |
143 |
|
167 |
|
144 |
protected void passwordVisibility() { |
168 |
protected void passwordVisibility() { |
Lines 167-173
Link Here
|
167 |
return false; |
191 |
return false; |
168 |
} |
192 |
} |
169 |
} |
193 |
} |
170 |
setMessage(passwordChange ? SecUIMessages.messageLoginChange : SecUIMessages.messageLogin, IMessageProvider.NONE); |
194 |
setMessage("", IMessageProvider.NONE); //$NON-NLS-1$ |
171 |
return true; |
195 |
return true; |
172 |
} |
196 |
} |
173 |
|
197 |
|