@Override
        public void widgetSelected(SelectionEvent e) {
          if (fIsUpdating) {
            return;
          }
          if (fActModel == null) {
            return;
          }

          if (fButtonNone.getSelection()) {
            fStackComposite.setControl(null);
            fActModel.getCompleteActType().setChoice(ICompleteActType.COMPLETE_NONE);
          } else if (fButtonWhenRolePartsCompleted.getSelection()) {
            fStackComposite.setControl(fRolePartListViewer.getControl());
            fActModel
                .getCompleteActType()
                .setChoice(ICompleteActType.COMPLETE_WHEN_ROLE_PART_COMPLETED);
          } else if (fButtonTimeLimit.getSelection()) {
            fStackComposite.setControl(fTimeLimitComposite);
            fActModel.getCompleteActType().setChoice(ICompleteActType.COMPLETE_TIME_LIMIT);
          } else if (fButtonWhenPropertySet.getSelection()) {
            fStackComposite.setControl(fCompleteActPropertyEditor);
            fActModel.getCompleteActType().setChoice(ICompleteActType.COMPLETE_WHEN_PROPERTY_SET);
          } else if (fButtonWhenConditionTrue.getSelection()) {
            fStackComposite.setControl(fWhenConditionTrueEditor);
            fActModel.getCompleteActType().setChoice(ICompleteActType.COMPLETE_WHEN_CONDITION_TRUE);
          }

          fActModel.getLDModel().setDirty();
        }
  public void refresh() {
    if (fActModel == null) {
      return;
    }

    fIsUpdating = true;

    fButtonNone.setSelection(false);
    fButtonWhenRolePartsCompleted.setSelection(false);
    fButtonTimeLimit.setSelection(false);
    fButtonWhenPropertySet.setSelection(false);
    fButtonWhenConditionTrue.setSelection(false);

    // Choice
    int choice = fActModel.getCompleteActType().getChoice();
    switch (choice) {
      case ICompleteActType.COMPLETE_NONE:
        fButtonNone.setSelection(true);
        fStackComposite.setControl(null);
        break;

      case ICompleteActType.COMPLETE_WHEN_ROLE_PART_COMPLETED:
        fButtonWhenRolePartsCompleted.setSelection(true);
        fStackComposite.setControl(fRolePartListViewer.getControl());
        break;

      case ICompleteActType.COMPLETE_TIME_LIMIT:
        fButtonTimeLimit.setSelection(true);
        fStackComposite.setControl(fTimeLimitComposite);
        break;

      case ICompleteActType.COMPLETE_WHEN_PROPERTY_SET:
        fButtonWhenPropertySet.setSelection(true);
        fStackComposite.setControl(fCompleteActPropertyEditor);
        break;

      case ICompleteActType.COMPLETE_WHEN_CONDITION_TRUE:
        fButtonWhenConditionTrue.setSelection(true);
        fStackComposite.setControl(fWhenConditionTrueEditor);
        break;

      default:
        break;
    }

    // Time Limit
    fTimeLimitComposite.setTimeLimitType(fActModel.getCompleteActType().getTimeLimitType());

    // Properties 1
    fCompleteActPropertyEditor.setOwner(fActModel.getCompleteActType());

    // Properties 2
    fOnCompleteActPropertyEditor.setOwner(fActModel.getOnCompletionType());

    // Role Parts
    fRolePartListViewer.setActModel(fActModel);

    // Conditions Editor
    fWhenConditionTrueEditor.setActModel(fActModel);

    // Notifications
    fOnCompletionNotificationsComposite.setOnCompletionType(fActModel.getOnCompletionType());

    fIsUpdating = false;
  }
  public void createControls() {
    InspectorWidgetFactory factory = InspectorWidgetFactory.getInstance();

    Composite composite = factory.createComposite(this);
    composite.setLayout(new GridLayout(2, false));
    setContent(composite);

    Group group =
        factory.createGroup(
            composite,
            Messages.CompleteActSection_0 + LDModelUtils.getUserObjectName(LDModelFactory.ACT));
    group.setLayout(new GridLayout());
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

    fButtonNone = factory.createButton(group, Messages.CompleteActSection_1, SWT.RADIO);
    fButtonNone.addSelectionListener(fSelectionListener);

    fButtonWhenRolePartsCompleted =
        factory.createButton(group, Messages.CompleteActSection_2, SWT.RADIO);
    fButtonWhenRolePartsCompleted.addSelectionListener(fSelectionListener);

    fButtonTimeLimit = factory.createButton(group, Messages.CompleteActSection_3, SWT.RADIO);
    fButtonTimeLimit.addSelectionListener(fSelectionListener);

    fButtonWhenPropertySet = factory.createButton(group, Messages.CompleteActSection_4, SWT.RADIO);
    fButtonWhenPropertySet.addSelectionListener(fSelectionListener);

    fButtonWhenConditionTrue =
        factory.createButton(group, Messages.CompleteActSection_5, SWT.RADIO);
    fButtonWhenConditionTrue.addSelectionListener(fSelectionListener);

    fStackComposite = new StackComposite(composite, SWT.NULL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 150;
    fStackComposite.setLayoutData(gd);
    factory.adapt(fStackComposite);

    fTimeLimitComposite = new TimeLimitComposite(fStackComposite, SWT.NULL);
    fRolePartListViewer = new RolePartListViewer(fStackComposite, SWT.BORDER);
    fCompleteActPropertyEditor = new PropertyValueEditorComposite(fStackComposite, SWT.NULL);
    fWhenConditionTrueEditor = new WhenConditionTrueComposite(fStackComposite, SWT.NULL);

    // Advanced
    fAdvancedSection = factory.createSection(composite, Section.TITLE_BAR | Section.TWISTIE);
    fAdvancedSection.setText(Messages.CompleteActSection_6);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.horizontalSpan = 2;
    fAdvancedSection.setLayoutData(gd);
    fAdvancedSection.setExpanded(EXPANDED_STATE);

    Composite compositeAdvanced = factory.createComposite(fAdvancedSection);
    compositeAdvanced.setLayout(new GridLayout());
    fAdvancedSection.setClient(compositeAdvanced);

    factory.createLabel(
        compositeAdvanced,
        Messages.CompleteActSection_7
            + " "
            + //$NON-NLS-1$
            LDModelUtils.getUserObjectName(LDModelFactory.ACT)
            + " "
            + //$NON-NLS-1$
            Messages.CompleteActSection_8);

    fOnCompleteActPropertyEditor = new PropertyValueEditorComposite(compositeAdvanced, SWT.NULL);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 150;
    fOnCompleteActPropertyEditor.setLayoutData(gd);

    // On Completion Notifications
    factory.createLabel(compositeAdvanced, Messages.CompleteActSection_9);
    fOnCompletionNotificationsComposite =
        new OnCompletionNotificationsComposite(compositeAdvanced, SWT.BORDER);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 200;
    fOnCompletionNotificationsComposite.setLayoutData(gd);

    fAdvancedSection.addExpansionListener(
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            doLayout();
            EXPANDED_STATE = e.getState();
          }
        });

    doLayout();
  }