Esempio n. 1
0
  @Override
  public void widgetSelected(SelectionEvent e) {
    if (mIgnore) {
      return;
    }

    Object source = e.getSource();
    if (source == mExistingRadioButton) {
      mProjectList.setEnabled(true);
      mValues.testingSelf = false;
      setExistingProject(getSelectedProject());
      mProjectList.setFocus();
    } else if (source == mCurrentRadioButton) {
      mProjectList.setEnabled(false);
      mValues.testingSelf = true;
      mValues.testedProject = null;
    } else {
      // The event must be from the project list, which unfortunately doesn't
      // pass itself as the selection event, it passes a reference to some internal
      // table widget that it uses, so we check for this case last
      IProject project = getSelectedProject();
      if (project != mValues.testedProject) {
        setExistingProject(project);
      }
    }

    validatePage();
  }
Esempio n. 2
0
  @Override
  public void setVisible(boolean visible) {
    super.setVisible(visible);
    mPageShown = true;

    if (visible) {
      try {
        mIgnore = true;
        mCurrentRadioButton.setSelection(mValues.testingSelf);
        mExistingRadioButton.setSelection(!mValues.testingSelf);
        mProjectList.setEnabled(!mValues.testingSelf);

        if (mProjectList.isEmpty()) {
          initializeList();
        }
        if (!mValues.testingSelf) {
          mProjectList.setFocus();
          IProject project = getSelectedProject();
          if (project != null) {
            // The FilteredList seems to -insist- on selecting the first item
            // in the list, even when the selection is explicitly set to an empty
            // array. This means the user is looking at a selection, so we need
            // to also go ahead and select this item in the model such that the
            // two agree, even if we would have preferred to have no initial
            // selection.
            mValues.testedProject = project;
          }
        }
      } finally {
        mIgnore = false;
      }
    }

    validatePage();
  }