public UsageDataPreferencePage() {
    super();
    setPreferenceStore(UiUsageMonitorPlugin.getDefault().getPreferenceStore());
    setDescription(DESCRIPTION);

    studyParameters = UiUsageMonitorPlugin.getDefault().getStudyParameters();
  }
 public UsageSummaryEditorWizardPage() {
   super(TITLE);
   setTitle(TITLE);
   StudyParameters studyParameters = UiUsageMonitorPlugin.getDefault().getStudyParameters();
   setDescription(NLS.bind(DESCRIPTION, studyParameters.getStudyName()));
   setImageDescriptor(
       AbstractUIPlugin.imageDescriptorFromPlugin(
           UiUsageMonitorPlugin.ID_PLUGIN, "icons/wizban/banner-usage.gif")); // $NON-NLS-1$
 }
  @Override
  public boolean performOk() {
    getPreferenceStore()
        .setValue(
            MonitorPreferenceConstants.PREF_MONITORING_OBFUSCATE, enableObfuscation.getSelection());
    if (enableMonitoring.getSelection()) {
      UiUsageMonitorPlugin.getDefault().startMonitoring();
    } else {
      UiUsageMonitorPlugin.getDefault().stopMonitoring();
    }

    getPreferenceStore()
        .setValue(
            MonitorPreferenceConstants.PREF_MONITORING_ENABLE_SUBMISSION,
            enableSubmission.getSelection());

    getPreferenceStore()
        .setValue(
            MonitorPreferenceConstants.PREF_MONITORING_ENABLED, enableMonitoring.getSelection());

    long transmitFrequency = UiUsageMonitorPlugin.DEFAULT_DELAY_BETWEEN_TRANSMITS;

    String submissionFrequency = submissionTime.getText();

    try {
      transmitFrequency = Integer.parseInt(submissionFrequency);
      transmitFrequency *= DAYS_IN_MS;
    } catch (NumberFormatException nfe) {
      // do nothing, transmitFrequency will have the default value
    }

    getPreferenceStore()
        .setValue(MonitorPreferenceConstants.PREF_MONITORING_SUBMIT_FREQUENCY, transmitFrequency);

    studyParameters.setTransmitPromptPeriod(transmitFrequency);
    return true;
  }
  private void createLogFileSection(Composite parent) {
    final Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
    group.setText(Messages.UsageDataPreferencePage_Monitoring);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    enableMonitoring = new Button(group, SWT.CHECK);
    enableMonitoring.setText(Messages.UsageDataPreferencePage_Enable_Logging_To);
    enableMonitoring.setSelection(
        getPreferenceStore().getBoolean(MonitorPreferenceConstants.PREF_MONITORING_ENABLED));
    enableMonitoring.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent e) {
            updateEnablement();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
          }
        });

    String logFilePath = UiUsageMonitorPlugin.getDefault().getMonitorLogFile().getPath();
    logFilePath = logFilePath.replaceAll("\\\\", "/"); // $NON-NLS-1$//$NON-NLS-2$
    logFileText = new Text(group, SWT.BORDER);
    logFileText.setText(logFilePath);
    logFileText.setEditable(false);
    logFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    enableObfuscation = new Button(group, SWT.CHECK);
    enableObfuscation.setText(Messages.UsageDataPreferencePage_Obfuscate_Elements_Using);
    enableObfuscation.setSelection(
        getPreferenceStore().getBoolean(MonitorPreferenceConstants.PREF_MONITORING_OBFUSCATE));

    if (studyParameters.forceObfuscation()) {
      enableObfuscation.setSelection(true);
      enableObfuscation.setEnabled(false);
    }

    Label obfuscationLablel = new Label(group, SWT.NULL);
    obfuscationLablel.setText(
        InteractionEventObfuscator.ENCRYPTION_ALGORITHM
            + Messages.UsageDataPreferencePage_Message_Digest_One_Way_Hash);
  }
 @Override
 public void performDefaults() {
   super.performDefaults();
   logFileText.setText(UiUsageMonitorPlugin.getDefault().getMonitorLogFile().getPath());
 }
  private void createUsageSection(Composite parent) {
    Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
    group.setText(Messages.UsageDataPreferencePage_Usage_Feedback);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label label = new Label(group, SWT.NULL);
    label.setText(Messages.UsageDataPreferencePage_Upload_Url);
    uploadUrl = new Text(group, SWT.BORDER);
    uploadUrl.setEditable(false);
    uploadUrl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    uploadUrl.setText(studyParameters.getUploadServletUrl());

    Label events = new Label(group, SWT.NULL);
    events.setText(Messages.UsageDataPreferencePage_Total_Events);
    Label logged = new Label(group, SWT.NULL);
    logged.setText(
        ""
            + getPreferenceStore()
                .getInt(MonitorPreferenceConstants.PREF_NUM_USER_EVENTS)); // $NON-NLS-1$

    events = new Label(group, SWT.NULL);
    events.setText(Messages.UsageDataPreferencePage_Events_Since_Upload);
    logged = new Label(group, SWT.NULL);
    logged.setText(
        ""
            + getPreferenceStore()
                .getInt(
                    MonitorPreferenceConstants
                        .PREF_NUM_USER_EVENTS_SINCE_LAST_UPLOAD)); //$NON-NLS-1$

    Composite enableSubmissionComposite = new Composite(group, SWT.NULL);
    GridLayout submissionGridLayout = new GridLayout(4, false);
    submissionGridLayout.marginWidth = 0;
    submissionGridLayout.marginHeight = 0;
    enableSubmissionComposite.setLayout(submissionGridLayout);
    enableSubmission = new Button(enableSubmissionComposite, SWT.CHECK);

    enableSubmission.setText(Messages.UsageDataPreferencePage_Enable_Submission_Every);
    enableSubmission.setSelection(
        getPreferenceStore()
            .getBoolean(MonitorPreferenceConstants.PREF_MONITORING_ENABLE_SUBMISSION));
    enableSubmission.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            updateEnablement();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    submissionTime = new Text(enableSubmissionComposite, SWT.BORDER | SWT.RIGHT);
    GridData gridData = new GridData();
    gridData.widthHint = 15;
    submissionTime.setLayoutData(gridData);
    long submissionFreq = UiUsageMonitorPlugin.DEFAULT_DELAY_BETWEEN_TRANSMITS;
    if (UiUsageMonitorPlugin.getDefault()
        .getPreferenceStore()
        .contains(MonitorPreferenceConstants.PREF_MONITORING_SUBMIT_FREQUENCY)) {
      submissionFreq =
          getPreferenceStore().getLong(MonitorPreferenceConstants.PREF_MONITORING_SUBMIT_FREQUENCY);
    }
    long submissionFreqInDays = submissionFreq / DAYS_IN_MS;
    submissionTime.setText("" + submissionFreqInDays); // $NON-NLS-1$
    submissionTime.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {}
        });
    Label label2 = new Label(enableSubmissionComposite, SWT.NONE);
    label2.setText(Messages.UsageDataPreferencePage_Days);
  }