コード例 #1
0
  /**
   * Sets up the assertion preservation part of the UI.
   *
   * @param composite on which to install the UI.
   * @param cfg to be used.
   * @pre composite != null and cfg != null
   */
  private void setupAssertionUI(final Composite composite, final SlicerConfiguration cfg) {
    final Group _assertionGroup = new Group(composite, SWT.NONE);
    final GridData _gridData1 = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    _gridData1.horizontalSpan = 3;
    _gridData1.grabExcessHorizontalSpace = true;
    _assertionGroup.setLayoutData(_gridData1);

    final GridLayout _gl1 = new GridLayout(3, false);
    _assertionGroup.setLayout(_gl1);
    _assertionGroup.setText("Preservation of assertions in the system");

    final Button _assertionPreservingSliceButton = new Button(_assertionGroup, SWT.CHECK);
    _assertionPreservingSliceButton.setText("Preserve assertions");
    _assertionPreservingSliceButton.setEnabled(true);

    final GridData _gd2 = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    _gd2.horizontalSpan = 1;
    _assertionPreservingSliceButton.setLayoutData(_gd2);

    final Button _applclasses = new Button(_assertionGroup, SWT.CHECK);
    _applclasses.setText("Preserve assertions in application classes only");
    _applclasses.addSelectionListener(
        new BooleanPropertySelectionListener(
            SlicerConfiguration.ASSERTIONS_IN_APPLICATION_CLASSES_ONLY, _applclasses, cfg));
    _applclasses.setSelection(cfg.areAssertionsOnlyInAppClassesConsidered());

    final GridData _gd3 = new GridData(SWT.END, SWT.BEGINNING, false, false);
    _gd3.horizontalSpan = 2;
    _gd3.grabExcessHorizontalSpace = true;
    _applclasses.setLayoutData(_gd3);

    final SelectionListener _sl1 =
        new BooleanPropertySelectionListener(
            SlicerConfiguration.SLICE_TO_PRESERVE_ASSERTIONS,
            _assertionPreservingSliceButton,
            cfg) {
          @Override
          public void widgetSelected(@SuppressWarnings("unused") final SelectionEvent evt) {
            final boolean _value = button.getSelection();
            containingConfiguration.setProperty(id, Boolean.valueOf(_value));
            _applclasses.setEnabled(_value);
          }
        };
    _assertionPreservingSliceButton.addSelectionListener(_sl1);

    _assertionPreservingSliceButton.setSelection(cfg.getSliceToPreserveAssertions());
    _assertionPreservingSliceButton.notifyListeners(SWT.Selection, null);
  }