33 import org.eclipse.swt.layout.GridData; |
33 import org.eclipse.swt.layout.GridData; |
34 import org.eclipse.swt.widgets.Composite; |
34 import org.eclipse.swt.widgets.Composite; |
35 import org.eclipse.swt.widgets.Button; |
35 import org.eclipse.swt.widgets.Button; |
36 import org.eclipse.swt.widgets.Event; |
36 import org.eclipse.swt.widgets.Event; |
37 import org.eclipse.swt.widgets.Label; |
37 import org.eclipse.swt.widgets.Label; |
38 import org.eclipse.swt.widgets.Link; |
|
39 import org.eclipse.swt.widgets.Listener; |
38 import org.eclipse.swt.widgets.Listener; |
40 import org.eclipse.swt.widgets.Shell; |
39 import org.eclipse.swt.widgets.Shell; |
41 |
40 |
42 /** |
41 /** |
43 * PermissionConfirmationView asks permissions confirmation |
42 * PermissionConfirmationView asks permissions confirmation |
91 * This method is called once before view is opened. |
90 * This method is called once before view is opened. |
92 */ |
91 */ |
93 protected void createView() |
92 protected void createView() |
94 { |
93 { |
95 // Add header. |
94 // Add header. |
96 String title = "Install?"; |
95 addHeader(null, iInstallInfo, null); |
97 String appName = ""; |
|
98 if (iInstallInfo != null) |
|
99 { |
|
100 if (iInstallInfo.getOldVersion() != null) |
|
101 { |
|
102 title = "Update?"; |
|
103 } |
|
104 appName = iInstallInfo.getName(); |
|
105 } |
|
106 addHeader(title, iInstallInfo, null); |
|
107 |
96 |
108 GridData gridData = null; |
97 GridData gridData = null; |
109 int horizontalSpan = getColumns(); |
|
110 int labelStyle = SWT.WRAP; |
98 int labelStyle = SWT.WRAP; |
111 |
99 |
112 // Add permission query label. |
100 // Add permission query label. |
113 Label domainLabel = createLabel( |
101 int detailsColumns = 2; |
114 InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY, |
102 int horizontalSpan = getColumns() - detailsColumns; |
115 new String[] { appName }), |
103 Label permissionQueryLabel = createLabel( |
|
104 InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY), |
116 horizontalSpan, labelStyle); |
105 horizontalSpan, labelStyle); |
|
106 setCssId(permissionQueryLabel, "permissionDetails"); |
117 |
107 |
118 // Add link for permission details. |
108 // Add link for permission details. |
119 if (iPermissionInfo != null && |
109 if (iPermissionInfo != null && |
120 iPermissionInfo.getPermissionNames() != null && |
110 iPermissionInfo.getPermissionNames() != null && |
121 iPermissionInfo.getPermissionNames().length > 0) |
111 iPermissionInfo.getPermissionNames().length > 0) |
122 { |
112 { |
123 Link detailsLink = new Link(getComposite(), SWT.NONE); |
113 horizontalSpan = detailsColumns; |
124 detailsLink.setText( |
114 Button detailsButton = new Button(getComposite(), SWT.NONE); |
125 "<a>" + |
115 setCssId(detailsButton, "detailsLink"); |
126 InstallerUiTexts.get(InstallerUiTexts.PERM_VIEW_DETAILS) + |
116 detailsButton.setText( |
127 "</a>"); |
117 InstallerUiTexts.get(InstallerUiTexts.PERM_VIEW_DETAILS)); |
128 detailsLink.addListener(SWT.Selection, new Listener() |
118 detailsButton.addListener(SWT.Selection, new Listener() |
129 { |
119 { |
130 public void handleEvent(Event aEvent) |
120 public void handleEvent(Event aEvent) |
131 { |
121 { |
132 openDetailsView(); |
122 openDetailsView(); |
133 } |
123 } |
134 }); |
124 }); |
135 gridData = new GridData(GridData.FILL_HORIZONTAL); |
125 gridData = new GridData(GridData.FILL_HORIZONTAL); |
136 gridData.horizontalSpan = horizontalSpan; |
126 gridData.horizontalSpan = horizontalSpan; |
137 detailsLink.setLayoutData(gridData); |
127 detailsButton.setLayoutData(gridData); |
138 addSoftKeyListenerFor(detailsLink); |
128 addSoftKeyListenerFor(detailsButton); |
139 } |
129 } |
140 |
130 |
141 // Number of pixels on top of the buttons. |
131 horizontalSpan = getColumns(); |
142 int verticalIndent = 5; |
|
143 |
132 |
144 // Add allow button. |
133 // Add allow button. |
145 iAllowButton = new Button(getComposite(), SWT.NONE); |
134 iAllowButton = new Button(getComposite(), SWT.NONE); |
|
135 setCssId(iAllowButton, "allowButton"); |
146 iAllowButton.setText(InstallerUiTexts.get( |
136 iAllowButton.setText(InstallerUiTexts.get( |
147 InstallerUiTexts.PERM_ALLOW_ALWAYS)); |
137 InstallerUiTexts.PERM_ALLOW_ALWAYS)); |
148 iAllowButton.addListener(SWT.Selection, new Listener() |
138 iAllowButton.addListener(SWT.Selection, new Listener() |
149 { |
139 { |
150 public void handleEvent(Event aEvent) |
140 public void handleEvent(Event aEvent) |
167 // nop |
157 // nop |
168 } |
158 } |
169 }); |
159 }); |
170 gridData = new GridData(GridData.FILL_HORIZONTAL); |
160 gridData = new GridData(GridData.FILL_HORIZONTAL); |
171 gridData.horizontalSpan = horizontalSpan; |
161 gridData.horizontalSpan = horizontalSpan; |
172 gridData.verticalIndent = verticalIndent; |
|
173 iAllowButton.setLayoutData(gridData); |
162 iAllowButton.setLayoutData(gridData); |
174 iAllowButton.setFocus(); |
163 iAllowButton.setFocus(); |
175 addSoftKeyListenerFor(iAllowButton); |
164 addSoftKeyListenerFor(iAllowButton); |
176 |
165 |
177 // Add deny button. |
166 // Add deny button. |
178 iDenyButton = new Button(getComposite(), SWT.NONE); |
167 iDenyButton = new Button(getComposite(), SWT.NONE); |
|
168 setCssId(iDenyButton, "denyButton"); |
179 iDenyButton.setText(InstallerUiTexts.get( |
169 iDenyButton.setText(InstallerUiTexts.get( |
180 InstallerUiTexts.PERM_ASK_ME_LATER)); |
170 InstallerUiTexts.PERM_ASK_ME_LATER)); |
181 iDenyButton.addListener(SWT.Selection, new Listener() |
171 iDenyButton.addListener(SWT.Selection, new Listener() |
182 { |
172 { |
183 public void handleEvent(Event aEvent) |
173 public void handleEvent(Event aEvent) |
200 // nop |
190 // nop |
201 } |
191 } |
202 }); |
192 }); |
203 gridData = new GridData(GridData.FILL_HORIZONTAL); |
193 gridData = new GridData(GridData.FILL_HORIZONTAL); |
204 gridData.horizontalSpan = horizontalSpan; |
194 gridData.horizontalSpan = horizontalSpan; |
205 gridData.verticalIndent = verticalIndent; |
|
206 iDenyButton.setLayoutData(gridData); |
195 iDenyButton.setLayoutData(gridData); |
207 addSoftKeyListenerFor(iDenyButton); |
196 addSoftKeyListenerFor(iDenyButton); |
208 |
197 |
209 // Add cancel button. |
198 // Add cancel button. |
210 iCancelButton = new Button(getComposite(), SWT.NONE); |
199 iCancelButton = new Button(getComposite(), SWT.NONE); |
|
200 setCssId(iCancelButton, "cancelButton"); |
211 iCancelButton.setText(InstallerUiTexts.get(InstallerUiTexts.PERM_CANCEL)); |
201 iCancelButton.setText(InstallerUiTexts.get(InstallerUiTexts.PERM_CANCEL)); |
212 iCancelButton.addListener(SWT.Selection, new Listener() |
202 iCancelButton.addListener(SWT.Selection, new Listener() |
213 { |
203 { |
214 public void handleEvent(Event aEvent) |
204 public void handleEvent(Event aEvent) |
215 { |
205 { |