Author: adietish
Date: 2010-12-17 05:08:05 -0500 (Fri, 17 Dec 2010)
New Revision: 27581
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
Log:
[JBDS-1453] changed usage-repoting-enablement dialog to display "yes" and
"no" buttons and not to use a checkbox.
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2010-12-17
10:05:25 UTC (rev 27580)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2010-12-17
10:08:05 UTC (rev 27581)
@@ -129,7 +129,8 @@
public void run() {
UsageReportEnablementDialog dialog =
- new UsageReportEnablementDialog(true,
PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ new UsageReportEnablementDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
JBossToolsUsageActivator.getDefault().getUsageBranding());
if (dialog.open() == Window.OK) {
userResponse[0] = dialog.isReportEnabled();
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2010-12-17
10:05:25 UTC (rev 27580)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2010-12-17
10:08:05 UTC (rev 27581)
@@ -17,7 +17,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
@@ -31,35 +30,42 @@
*/
public class UsageReportEnablementDialog extends Dialog {
- private Button checkBox;
private boolean reportEnabled;
private IUsageBranding branding;
- public UsageReportEnablementDialog(boolean reportEnabled, IShellProvider parentShell,
IUsageBranding branding) {
+ public UsageReportEnablementDialog(IShellProvider parentShell, IUsageBranding branding)
{
super(parentShell);
- this.reportEnabled = reportEnabled;
this.branding = branding;
}
protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- this.reportEnabled = checkBox.getSelection();
- } else if (buttonId == IDialogConstants.CANCEL_ID) {
- this.reportEnabled = false;
+ this.reportEnabled = (buttonId == IDialogConstants.OK_ID);
+ if (IDialogConstants.NO_ID == buttonId) {
+ noPressed();
}
super.buttonPressed(buttonId);
}
+ /**
+ * Notifies that the no button of this dialog has been pressed.
+ * <p>
+ * The <code>Dialog</code> implementation of this framework method sets
this
+ * dialog's return code to <code>Window.OK</code> and closes the
dialog.
+ * </p>
+ */
+ protected void noPressed() {
+ setReturnCode(OK);
+ close();
+ }
+
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(branding.getStartupAllowReportingTitle());
}
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
false);
- checkBox.setFocus();
- checkBox.setSelection(reportEnabled);
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, false);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
}
protected Control createDialogArea(Composite parent) {
@@ -90,11 +96,6 @@
.grab(true, false)
.hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT)
.applyTo(link);
-
- // checkbox
- checkBox = new Button(composite, SWT.CHECK);
- checkBox.setText(branding.getStartupAllowReportingCheckboxLabel());
- GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT,
SWT.CENTER).applyTo(checkBox);
}
public boolean isReportEnabled() {
Show replies by date