public void inject(ILDModel model, String content) throws Exception {
    IActivityModel activity =
        (IActivityModel) LDModelFactory.createModelObject(LDModelFactory.SUPPORT_ACTIVITY, model);

    id = PersistenceUtility.getValidResourceName(model, "SupportActivity-", id);
    activity.setTitle("SupportActivity-" + id);

    LDModelUtils.setNewObjectDefaults(activity, content, LDModelUtils.HTML_FILE);
  }
Пример #2
0
  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();
  }