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