/** Checks if Preference Page is complete and valid */
 protected void checkCompleteness() {
   if (m_cleanResultDays.isEnabled() && m_cleanResultDays.getValue() <= 0) {
     setErrorMessage(Messages.TestResultViewPreferencePageCleanResultDaysEmpty);
     setValid(false);
     return;
   }
   setErrorMessage(null);
   setValid(true);
 }
  /** @param parent The parent <code>Composite</code> */
  private void createCleanTestResults(Composite parent) {
    m_cleanTestresults = new Button(parent, SWT.CHECK);
    m_cleanTestresults.setText(Messages.TestResultViewPreferencePageCleanResults);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 1;
    gridData.grabExcessHorizontalSpace = false;
    m_cleanTestresults.setLayoutData(gridData);
    int testResultCleanupInterval = getProject().getTestResultCleanupInterval();
    m_cleanTestresults.setSelection(testResultCleanupInterval != IProjectPO.NO_CLEANUP);
    m_cleanTestresults.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            enableCleanResultDaysTextfield();
            checkCompleteness();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            // nothing here
          }
        });
    m_cleanResultDays = new CheckedIntText(parent, SWT.BORDER, false, 1, Integer.MAX_VALUE);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.horizontalSpan = 1;
    gridData.grabExcessHorizontalSpace = false;
    gridData.widthHint = 80;
    m_cleanResultDays.setLayoutData(gridData);
    if (testResultCleanupInterval > 0) {
      m_cleanResultDays.setText(String.valueOf(testResultCleanupInterval));
    }
    m_cleanResultDays.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent e) {
            // nothing
          }

          public void keyReleased(KeyEvent e) {
            checkCompleteness();
          }
        });
    Label label = new Label(parent, SWT.NONE);
    label.setText(Messages.TestResultViewPreferencePageCleanDaysLabel);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.horizontalSpan = 1;
    gridData.grabExcessHorizontalSpace = false;
    label.setLayoutData(gridData);
    enableCleanResultDaysTextfield();
    ControlDecorator.decorateInfo(
        label, "TestResultViewPreferencePage.cleanResultsInfo", false); // $NON-NLS-1$
  }
 /** store preferences made for auto test result cleanup */
 private void storeAutoTestResultCleanup() {
   if (m_cleanResultDays != null) {
     if (m_cleanTestresults != null) {
       boolean autoClean = m_cleanTestresults.getSelection();
       if (autoClean) {
         getProject().setTestResultCleanupInterval(Integer.valueOf(m_cleanResultDays.getText()));
       } else {
         getProject().setTestResultCleanupInterval(IProjectPO.NO_CLEANUP);
       }
     }
   }
 }
 protected void enableCleanResultDaysTextfield() {
   m_cleanResultDays.setEnabled(m_cleanTestresults.getSelection());
 }