Exemplo n.º 1
0
  /** Note: createControls is not called between selection PE of same type (e.g. transition). */
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    Composite composite = factory.createFlatFormComposite(parent);

    valueLabel = factory.createCLabel(composite, "Condition:");
    nameTextVal = factory.createText(composite, "");

    allowedModes = factory.createCCombo(composite);

    addLayout(parent);

    nameTextVal.addModifyListener(
        new ModifyListener() {

          public void modifyText(ModifyEvent e) {
            // name = Misc.checkString(nameTextVal);
            name = nameTextVal.getText();

            if (listenerFlag) {
              if (!name.equals("") && updateDomainAndPE()) {
                nameTextVal.setBackground(null);
              } else {
                // show error indication
                Display display = Display.getCurrent();
                Color color = display.getSystemColor(SWT.COLOR_RED);
                nameTextVal.setBackground(color);
              }
            }
          }
        });
  }
  @Override
  public void createCompositeContent(
      Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    parent.setLayout(new FillLayout(SWT.VERTICAL | SWT.V_SCROLL));
    super.createCompositeContent(parent, aTabbedPropertySheetPage);

    GridData layoutData;
    TabbedPropertySheetWidgetFactory toolkit = aTabbedPropertySheetPage.getWidgetFactory();
    Composite content = new LayoutComposite(parent);
    Composite outputComposite = toolkit.createFlatFormComposite(content);

    outputComposite.setLayout(new GridLayout(1, true));
    outputLocationPane.createControl(outputComposite, Messages.outputLocationPaneTitle, toolkit);
    layoutData =
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    outputLocationPane.getControl().setLayoutData(layoutData);

    Composite root = new LayoutComposite(parent);
    Composite rootComposite = toolkit.createFlatFormComposite(root);
    rootComposite.setLayout(new GridLayout(1, true));
    createRootSection(rootComposite, toolkit);

    rootComposite.layout();
    outputComposite.layout();
  }
Exemplo n.º 3
0
  public StereotypeImageEditor(Composite parent, int style) {

    TabbedPropertySheetWidgetFactory factory = AbstractEditor.factory;

    composite = factory.createFlatFormComposite(parent);
    FormData data;

    browseButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$
    browseButton.setImage(Activator.getDefault().getImage(addImagePath));
    removeButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$
    removeButton.setImage(Activator.getDefault().getImage("/icons/delete.gif")); // $NON-NLS-1$
    CLabel iconLabel = factory.createCLabel(composite, "Content: ");

    // browseButton layout
    data = new FormData();
    data.left = new FormAttachment(0, 85);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
    browseButton.setLayoutData(data);

    // removeButton layout
    data = new FormData();
    data.left = new FormAttachment(browseButton, ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
    removeButton.setLayoutData(data);

    // iconLabel layout
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
    iconLabel.setLayoutData(data);

    browseButton.addSelectionListener(this);

    removeButton.addSelectionListener(this);
  }
  protected Control createResourceComposite(
      Section section, TabbedPropertySheetWidgetFactory widgetFactory) {
    final Composite client = widgetFactory.createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());
    resourceText = widgetFactory.createText(client, "");
    resourceText.setLayoutData(
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    final ControlDecoration cd = new ControlDecoration(resourceText, SWT.LEFT);
    cd.setImage(Pics.getImage(PicsConstants.hint));
    cd.setDescriptionText(Messages.filewidget_resource_hint);

    final Button browseResourceButton =
        widgetFactory.createButton(client, Messages.Browse, SWT.PUSH);
    browseResourceButton.setLayoutData(GridDataFactory.fillDefaults().create());
    browseResourceButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final SelectDocumentInBonitaStudioRepository selectDocumentInBonitaStudioRepository =
                new SelectDocumentInBonitaStudioRepository(Display.getDefault().getActiveShell());
            if (IDialogConstants.OK_ID == selectDocumentInBonitaStudioRepository.open()) {
              resourceText.setText(
                  selectDocumentInBonitaStudioRepository.getSelectedDocument().getName());
            }
          }
        });
    return client;
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    Composite composite = factory.createFlatFormComposite(parent);
    FormData data;

    cancelActivityCombo = factory.createCCombo(composite, SWT.NONE);
    cancelActivityCombo.setItems((String[]) cancelFormats.toArray());
    data = new FormData();
    data.left = new FormAttachment(0, 160);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    cancelActivityCombo.setLayoutData(data);
    cancelActivityCombo.addFocusListener(listener);

    createLabel(composite, "Cancel activity", cancelActivityCombo, factory); // $NON-NLS-1$

    messageCombo = getWidgetFactory().createCCombo(composite, SWT.NONE);
    data = new FormData();
    data.left = new FormAttachment(0, 160);
    data.right = new FormAttachment(100, -HSPACE);
    data.top = new FormAttachment(cancelActivityCombo, VSPACE);
    messageCombo.setLayoutData(data);
    messageCombo.addFocusListener(listener);

    createLabel(composite, "Message ref", messageCombo, factory); // $NON-NLS-1$
  }
Exemplo n.º 6
0
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();

    Composite composite = factory.createComposite(parent);
  }
  /**
   * Constructor for TabbedPropertyTitle.
   *
   * @param parent the parent composite.
   * @param factory the widget factory for the tabbed property sheet
   */
  public TabbedPropertyTitle(Composite parent, TabbedPropertySheetWidgetFactory factory) {
    super(parent, SWT.NO_FOCUS);
    this.factory = factory;

    // RAP not suppported
    //		this.addPaintListener(new PaintListener() {
    //
    //			public void paintControl(PaintEvent e) {
    //				if (image == null && (text == null || text.equals(BLANK))) {
    //					label.setVisible(false);
    //				} else {
    //					label.setVisible(true);
    //					drawTitleBackground(e);
    //				}
    //			}
    //		});
    // /RAP

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = 1;
    layout.marginHeight = 2;
    setLayout(layout);

    Font font;
    if (!JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) {
      FontData[] fontData =
          JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT).getFontData();
      /* title font is 2pt larger than that used in the tabs. */
      fontData[0].setHeight(fontData[0].getHeight() + 2);
      JFaceResources.getFontRegistry().put(TITLE_FONT, fontData);
    }
    font = JFaceResources.getFont(TITLE_FONT);

    label = factory.createCLabel(this, BLANK);
    //		label.setBackground(new Color[] {
    //				factory.getColors().getColor(IFormColors.H_GRADIENT_END),
    //				factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
    //				new int[] { 100 }, true);
    label.setFont(font);
    label.setForeground(factory.getColors().getColor(IFormColors.TITLE));
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls
   * (org.eclipse.swt.widgets.Composite,
   * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
   */
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    _composite = new PageBook(parent, SWT.NONE);
    factory.adapt(_composite);

    _blank = factory.createFlatFormComposite(_composite);
    _composite.showPage(_blank);
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    Composite composite = factory.createFlatFormComposite(parent);

    initiatorText = createText(composite, factory, null);
    createLabel(composite, "Initiator", initiatorText, factory); // $NON-NLS-1$

    formKeyText = createText(composite, factory, initiatorText);
    createLabel(composite, "Form key:", formKeyText, factory); // $NON-NLS-1$
  }
  @Override
  public void refresh() {
    PictogramElement pe = getSelectedPictogramElement();
    if (pe != null) {
      Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
      _interface = null;

      // the filter assured, that it is a Service or Reference
      if (bo == null) {
        _composite.showPage(_blank);
        _composite.redraw();
        return;
      }
      if (bo instanceof Contract) {
        Contract contract = (Contract) bo;
        _interface = contract.getInterface();
      }

      if (_interface != null) {
        if (_modelComposites.get(_interface) == null) {
          TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
          IInterfaceComposite composite =
              (IInterfaceComposite) InterfaceCompositeAdapter.adaptModelToComposite(_interface);
          if (composite != null) {
            ((AbstractSwitchyardComposite) composite).createContents(_composite, SWT.NONE);
            factory.adapt(((AbstractSwitchyardComposite) composite).getPanel());
            _modelComposites.put(_interface, composite);
          }
        }
        IInterfaceComposite composite = (IInterfaceComposite) _modelComposites.get(_interface);
        if (composite != null) {
          composite.setInterface(_interface);
          _composite.showPage(((AbstractSwitchyardComposite) composite).getPanel());
          Composite parent = _composite;
          // this is a hack to get it to refresh properly
          while (parent != null) {
            parent.layout(true, true);
            parent = parent.getParent();
          }
        } else {
          _composite.getParent().layout();
          _composite.showPage(_blank);
          _composite.layout(true, true);
        }
      } else {
        _composite.showPage(_blank);
        _composite.getParent().layout();
        _composite.layout(true, true);
      }
    }
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    final TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    _panel = factory.createComposite(parent);
    _panel.setLayout(new GridLayout(3, false));

    _newBPELLink = new Link(_panel, SWT.NONE);
    _newBPELLink.setText("<a>BPEL File:</a>");
    _newBPELLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            openFile();
          }
        });

    _bpelFileText = factory.createText(_panel, "", SWT.READ_ONLY);
    _bpelFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _bpelFileText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent event) {
            final QName newValue =
                _bpelFileText.getText().length() == 0
                    ? null
                    : QName.valueOf(_bpelFileText.getText());
            if (!_updating
                && ((newValue == null && _implementation.getProcess() != null)
                    || (newValue != null && !newValue.equals(_implementation.getProcess())))) {
              wrapOperation(
                  new Runnable() {
                    public void run() {
                      _implementation.setProcess(newValue);
                    }
                  });
            }
          }
        });

    _browseBPELButton = factory.createButton(_panel, "Browse...", SWT.PUSH);
    _browseBPELButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            handleBrowse();
          }
        });
  }
  protected Control createInputExpressionComposite(
      Section section, TabbedPropertySheetWidgetFactory widgetFactory) {
    final Composite client = widgetFactory.createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());

    inputExpressionViewer =
        new ExpressionViewer(
            client,
            SWT.BORDER,
            widgetFactory,
            editingDomain,
            FormPackage.Literals.WIDGET__INPUT_EXPRESSION);
    inputExpressionViewer.addFilter(
        new AvailableExpressionTypeFilter(
            new String[] {
              ExpressionConstants.VARIABLE_TYPE,
              ExpressionConstants.SCRIPT_TYPE,
              ExpressionConstants.CONSTANT_TYPE,
              ExpressionConstants.DOCUMENT_REF_TYPE,
              ExpressionConstants.PARAMETER_TYPE
            }));

    inputExpressionViewer.setMessage(getInputExpressionHint(), IStatus.INFO);
    inputExpressionViewer
        .getControl()
        .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    return client;
  }
Exemplo n.º 13
0
 @Override
 public void createCompositeContent(
     Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
   super.createCompositeContent(parent, aTabbedPropertySheetPage);
   TabbedPropertySheetWidgetFactory toolkit = aTabbedPropertySheetPage.getWidgetFactory();
   Composite noteComposite = toolkit.createComposite(endpointsComposite);
   GridData gridData = new GridData();
   gridData.horizontalSpan = 2;
   noteComposite.setLayoutData(gridData);
   noteComposite.setLayout(new GridLayout(1, false));
   orGroupCheckbox = new Button(noteComposite, SWT.CHECK);
   orGroupCheckbox.setText("Execute on each new input value");
   orGroupCheckbox.setData(CONTROL_PROPERTY_KEY, ScriptComponentConstants.PROP_KEY_XOR);
   orGroupCheckbox.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
   Label noteLabel = new Label(noteComposite, SWT.READ_ONLY);
   noteLabel.setText("(ie inputs have an 'xor' relation instead of an 'and' relation)");
 }
 /** @param e */
 protected void drawTitleBackground(PaintEvent e) {
   Rectangle bounds = getClientArea();
   //		label.setBackground(new Color[] {
   //				factory.getColors().getColor(IFormColors.H_GRADIENT_END),
   //				factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
   //				new int[] { 100 }, true);
   Color bg = factory.getColors().getColor(IFormColors.H_GRADIENT_END);
   Color gbg = factory.getColors().getColor(IFormColors.H_GRADIENT_START);
   GC gc = e.gc;
   gc.setForeground(bg);
   gc.setBackground(gbg);
   gc.fillGradientRectangle(bounds.x, bounds.y, bounds.width, bounds.height, true);
   // background bottom separator
   gc.setForeground(factory.getColors().getColor(IFormColors.H_BOTTOM_KEYLINE1));
   gc.drawLine(bounds.x, bounds.height - 2, bounds.x + bounds.width - 1, bounds.height - 2);
   gc.setForeground(factory.getColors().getColor(IFormColors.H_BOTTOM_KEYLINE2));
   gc.drawLine(bounds.x, bounds.height - 1, bounds.x + bounds.width - 1, bounds.height - 1);
 }
  /**
   * Create the controls of the TableSortSection.
   *
   * @param parent The parent composite
   * @param aTabbedPropertySheetPage The property sheet page
   */
  public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);

    widgetFactory = getWidgetFactory();

    Composite container = widgetFactory.createComposite(parent);
    container.setLayout(new GridLayout(1, false));

    computationParameters = new TableColumnComputationParamsComposite(container, SWT.FILL, true);
  }
 private CLabel createLabel(
     Composite parent, String text, Control control, TabbedPropertySheetWidgetFactory factory) {
   CLabel label = factory.createCLabel(parent, text); // $NON-NLS-1$
   FormData data = new FormData();
   data.left = new FormAttachment(0, 0);
   data.right = new FormAttachment(control, -HSPACE);
   data.top = new FormAttachment(control, 0, SWT.TOP);
   label.setLayoutData(data);
   return label;
 }
Exemplo n.º 17
0
  /** Create the main composite. */
  protected void createMainComposite() {
    mainComposite = factory.createComposite(this, SWT.NO_FOCUS);
    mainComposite.setLayout(new FormLayout());
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    mainComposite.setLayoutData(formData);

    createMainContents();
  }
  @Override
  protected void createControl(
      final Composite composite,
      final int style,
      final TabbedPropertySheetWidgetFactory widgetFactory) {
    mc = new MagicComposite(composite, SWT.INHERIT_DEFAULT);
    mc.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).create());
    checkBoxControl = new Button(mc, SWT.CHECK);
    if (widgetFactory != null) {
      widgetFactory.adapt(checkBoxControl, true, true);
    }
    checkBoxControl.setLayoutData(
        GridDataFactory.fillDefaults()
            .grab(false, true)
            .hint(SWT.DEFAULT, 30)
            .indent(16, 0)
            .align(SWT.BEGINNING, SWT.CENTER)
            .create());

    control = new Composite(mc, SWT.INHERIT_DEFAULT);
    if (widgetFactory != null) {
      widgetFactory.adapt(control);
    }
    control.addDisposeListener(disposeListener);
    control.setLayoutData(
        GridDataFactory.fillDefaults().grab(false, true).align(SWT.BEGINNING, SWT.CENTER).create());
    control.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).create());
    createTextControl(style, widgetFactory);

    createToolbar(style, widgetFactory);
    if ((style & SWT.BORDER) != 0) { // Not in a table
      createSwitchEditorControl(widgetFactory);
    }
    addDecorator(composite);
    mc.show(checkBoxControl);
    mc.hide(control);
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    Composite composite = factory.createFlatFormComposite(parent);
    FormData data;

    Group transactionGroup = factory.createGroup(composite, "Policy Details");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    transactionGroup.setLayoutData(data);
    transactionGroup.setLayout(new FormLayout());

    _interactionCombo =
        factory.createCCombo(transactionGroup, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    _interactionCombo.add("None");
    for (String label : _supportedInteractionPolicies) {
      _interactionCombo.add(label);
    }
    data = new FormData();
    data.left = new FormAttachment(5, 100);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    _interactionCombo.setLayoutData(data);

    _interactionComboLabel = factory.createCLabel(transactionGroup, "Transaction Policy:");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(_interactionCombo, -HSPACE);
    data.top = new FormAttachment(_interactionCombo, 0, SWT.CENTER);
    _interactionComboLabel.setLayoutData(data);

    _interactionCombo.addSelectionListener(new ComboSelectionListener());

    addDomainListener();
  }
  /** {@inheritDoc} */
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    final TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    final Composite composite = factory.createFlatFormComposite(parent);
    FormData data;

    nameWidget = factory.createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    nameWidget.setLayoutData(data);

    CLabel valueLabel = factory.createCLabel(composite, "Name");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(nameWidget, -HSPACE);
    data.top = new FormAttachment(nameWidget, 0, SWT.CENTER);
    valueLabel.setLayoutData(data);
  }
  private FileWidgetInputType createUseDocumentButton(
      TabbedPropertySheetWidgetFactory widgetFactory, final Composite radioComposite) {
    FileWidgetInputType initialInputType = element.getInputType();
    if (!ModelHelper.isAnEntryPageFlowOnAPool(ModelHelper.getParentForm(element))) {
      useDocumentButton =
          widgetFactory.createButton(radioComposite, Messages.useDocument, SWT.RADIO);
      useDocumentButton.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
              if (initialValueSection != null && !initialValueSection.isDisposed()) {
                if (useDocumentButton.getSelection()
                    && (element.getInputType() != FileWidgetInputType.DOCUMENT
                        || element.isDuplicate() != multiple
                        || initialValueSection.getClient() == null)) {
                  boolean recreate = false;
                  if (initialValueSection.getClient() == null
                      || element.getInputType() == FileWidgetInputType.RESOURCE) {
                    recreate = true;
                  }
                  editingDomain
                      .getCommandStack()
                      .execute(
                          SetCommand.create(
                              editingDomain,
                              element,
                              FormPackage.Literals.FILE_WIDGET__INPUT_TYPE,
                              FileWidgetInputType.DOCUMENT));
                  if (recreate) {
                    if (initialValueSection.getClient() != null) {
                      initialValueSection.getClient().dispose();
                    }
                    multiple = element.isDuplicate();
                    initialValueSection.setClient(
                        createInputExpressionComposite(
                            initialValueSection,
                            FileGridPropertySectionContribution.this.widgetFactory));

                    initialValueSection.setExpanded(true);
                    bindFields();
                  }
                }
              }
            }
          });
    } else {
      initialInputType = FileWidgetInputType.URL;
    }
    return initialInputType;
  }
 private Text createText(Composite parent, TabbedPropertySheetWidgetFactory factory, Control top) {
   Text text = factory.createText(parent, ""); // $NON-NLS-1$
   FormData data = new FormData();
   data.left = new FormAttachment(0, 160);
   data.right = new FormAttachment(100, -HSPACE);
   if (top == null) {
     data.top = new FormAttachment(0, VSPACE);
   } else {
     data.top = new FormAttachment(top, VSPACE);
   }
   text.setLayoutData(data);
   text.addFocusListener(listener);
   return text;
 }
  private void createUseResourceButton(Composite radioComposite) {
    useResourceButton = widgetFactory.createButton(radioComposite, Messages.useResource, SWT.RADIO);
    useResourceButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            if (initialValueSection != null && !initialValueSection.isDisposed()) {
              if (useResourceButton.getSelection()
                  && (element.getInputType() != FileWidgetInputType.RESOURCE
                      || element.isDuplicate() != multiple
                      || initialValueSection.getClient() == null)) {
                editingDomain
                    .getCommandStack()
                    .execute(
                        SetCommand.create(
                            editingDomain,
                            element,
                            FormPackage.Literals.FILE_WIDGET__INPUT_TYPE,
                            FileWidgetInputType.RESOURCE));
                if (initialValueSection.getClient() != null) {
                  initialValueSection.getClient().dispose();
                }
                if (element.isDuplicate()) {
                  multiple = true;
                  initialValueSection.setClient(
                      createMultipleResourceComposite(
                          initialValueSection,
                          FileGridPropertySectionContribution.this.widgetFactory));
                } else {
                  multiple = false;
                  initialValueSection.setClient(
                      createResourceComposite(
                          initialValueSection,
                          FileGridPropertySectionContribution.this.widgetFactory));
                }

                initialValueSection.setExpanded(true);
                bindFields();
              }
            }
          }
        });
  }
  protected Control createMultipleResourceComposite(
      Section section, TabbedPropertySheetWidgetFactory widgetFactory) {
    final Composite client = widgetFactory.createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    client.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());
    resourceTableViewer = new TableViewer(client, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
    resourceTableViewer
        .getControl()
        .setLayoutData(
            GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 60).create());
    resourceTableViewer.setContentProvider(new ArrayContentProvider());
    resourceTableViewer.setLabelProvider(new LabelProvider());
    final ControlDecoration cd =
        new ControlDecoration(resourceTableViewer.getControl(), SWT.TOP | SWT.LEFT);
    cd.setImage(Pics.getImage(PicsConstants.hint));
    cd.setDescriptionText(Messages.filewidget_resource_hint_multiple);

    final Composite buttonComposite = widgetFactory.createComposite(client);
    buttonComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
    buttonComposite.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 3).create());
    final Button addResourceButton =
        widgetFactory.createButton(buttonComposite, Messages.Add, SWT.PUSH);
    addResourceButton.setLayoutData(
        GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
    addResourceButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final SelectDocumentInBonitaStudioRepository selectDocumentInBonitaStudioRepository =
                new SelectDocumentInBonitaStudioRepository(Display.getDefault().getActiveShell());
            if (IDialogConstants.OK_ID == selectDocumentInBonitaStudioRepository.open()) {
              editingDomain
                  .getCommandStack()
                  .execute(
                      AddCommand.create(
                          editingDomain,
                          element,
                          FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST,
                          selectDocumentInBonitaStudioRepository.getSelectedDocument().getName()));
              resourceTableViewer.refresh();
            }
          }
        });
    final Button removeResourceButton =
        widgetFactory.createButton(buttonComposite, Messages.Remove, SWT.PUSH);
    removeResourceButton.setLayoutData(
        GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
    removeResourceButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            editingDomain
                .getCommandStack()
                .execute(
                    RemoveCommand.create(
                        editingDomain,
                        element,
                        FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST,
                        ((IStructuredSelection) resourceTableViewer.getSelection()).toList()));
            resourceTableViewer.refresh();
          }
        });

    resourceTableViewer.setInput(
        EMFEditProperties.list(
                editingDomain, FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST)
            .observe(element));

    return client;
  }
  /* (non-Javadoc)
   * @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory, org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection)
   */
  public void createControl(
      final Composite composite,
      TabbedPropertySheetWidgetFactory widgetFactory,
      ExtensibleGridPropertySection extensibleGridPropertySection) {
    composite.setLayout(new GridLayout(3, false));

    cCombo = widgetFactory.createCCombo(composite, SWT.BORDER);
    cCombo.setLayoutData(GridDataFactory.swtDefaults().hint(200, SWT.DEFAULT).create());
    final SimulationLoadProfileRepositoryStore profileStore =
        RepositoryManager.getInstance()
            .getRepositoryStore(SimulationLoadProfileRepositoryStore.class);
    for (IRepositoryFileStore artifact : profileStore.getChildren()) {
      cCombo.add(artifact.getDisplayName());
    }
    cCombo.setEditable(false);
    Button editLoadProfile = new Button(composite, SWT.FLAT);
    editLoadProfile.setText(Messages.edit);
    editLoadProfile.addSelectionListener(
        new SelectionAdapter() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            EditSimulationLoadProfileWizard wizard =
                new EditSimulationLoadProfileWizard(
                    profileStore.getChild(
                        cCombo.getText()
                            + "."
                            + SimulationLoadProfileRepositoryStore.SIMULATION_LOADPROFILE_EXT));
            new CustomWizardDialog(Display.getCurrent().getActiveShell(), wizard).open();
          }
        });
    Button createLoadProfile = new Button(composite, SWT.FLAT);
    createLoadProfile.setText(Messages.create);
    createLoadProfile.addSelectionListener(
        new SelectionAdapter() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            EditSimulationLoadProfileWizard wizard = new EditSimulationLoadProfileWizard();
            if (new CustomWizardDialog(Display.getCurrent().getActiveShell(), wizard).open()
                == IDialogConstants.OK_ID) {
              String id = wizard.getArtifact().getDisplayName();
              cCombo.add(id);
              cCombo.setText(id);
            }
          }
        });

    context = new EMFDataBindingContext();
    context.bindValue(
        SWTObservables.observeText(cCombo),
        EMFEditObservables.observeValue(
            editingDomain,
            eObject,
            SimulationPackage.Literals.SIMULATION_ABSTRACT_PROCESS__LOAD_PROFILE_ID));
    context.bindValue(
        SWTObservables.observeEnabled(editLoadProfile),
        SWTObservables.observeText(cCombo),
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
        new UpdateValueStrategy()
            .setConverter(
                new Converter(String.class, Boolean.class) {

                  public Object convert(Object fromObject) {
                    return ((String) fromObject).length() > 0;
                  }
                }));
  }
  /**
   * Method createControls.
   *
   * @param parent Composite
   * @param aTabbedPropertySheetPage TabbedPropertySheetPage
   * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(Composite,
   *     TabbedPropertySheetPage)
   */
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);

    // Tell element to build its own detailed tab layout
    final TabbedPropertySheetWidgetFactory widgetFactory =
        aTabbedPropertySheetPage.getWidgetFactory();
    final Composite composite = widgetFactory.createFlatFormComposite(parent);
    FormData data = null;

    // Position (read-only)
    widgetFactory.setBorderStyle(SWT.NULL);
    fPositionText = widgetFactory.createText(composite, "", SWT.NULL);
    data = new FormData();
    data.left = new FormAttachment(0, R4EUIConstants.TABBED_PROPERTY_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0); // $codepro.audit.disable numericLiterals
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    fPositionText.setEditable(false);
    fPositionText.setToolTipText(R4EUIConstants.CONTENTS_POSITION_TOOLTIP);
    fPositionText.setLayoutData(data);

    final CLabel positionLabel =
        widgetFactory.createCLabel(composite, R4EUIConstants.POSITION_LABEL);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(fPositionText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(fPositionText, 0, SWT.CENTER);

    positionLabel.setToolTipText(R4EUIConstants.CONTENTS_POSITION_TOOLTIP);
    positionLabel.setLayoutData(data);

    // Assigned To
    fAssignedToComposite = widgetFactory.createComposite(composite);
    data = new FormData();
    data.left = new FormAttachment(0, R4EUIConstants.TABBED_PROPERTY_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0); // $codepro.audit.disable numericLiterals
    data.top = new FormAttachment(fPositionText, ITabbedPropertyConstants.VSPACE);
    fAssignedToComposite.setToolTipText(R4EUIConstants.ASSIGNED_TO_TOOLTIP);
    fAssignedToComposite.setLayoutData(data);
    fAssignedToComposite.setLayout(new GridLayout(3, false));

    widgetFactory.setBorderStyle(SWT.BORDER);
    fAssignedToText = widgetFactory.createText(fAssignedToComposite, "");
    fAssignedToText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fAssignedToText.setEditable(false);
    fAssignedToButton =
        widgetFactory.createButton(fAssignedToComposite, R4EUIConstants.ADD_LABEL, SWT.NONE);
    fAssignedToButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    fAssignedToButton.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            ((R4EUIContent) fProperties.getElement()).addAssignees(UIUtils.getAssignParticipants());
            refresh();
            R4EUIModelController.getNavigatorView().getTreeViewer().refresh();
          }
        });

    fUnassignedFromButton =
        widgetFactory.createButton(fAssignedToComposite, R4EUIConstants.REMOVE_LABEL, SWT.NONE);
    fUnassignedFromButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    fUnassignedFromButton.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            ((R4EUIContent) fProperties.getElement())
                .removeAssignees(UIUtils.getUnassignParticipants(fProperties.getElement()));
            refresh();
            R4EUIModelController.getNavigatorView().getTreeViewer().refresh();
          }
        });

    final CLabel assignedToLabel =
        widgetFactory.createCLabel(composite, R4EUIConstants.ASSIGNED_TO_LABEL);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(fAssignedToComposite, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(fAssignedToComposite, 0, SWT.CENTER);
    assignedToLabel.setToolTipText(R4EUIConstants.ASSIGNED_TO_TOOLTIP);
    assignedToLabel.setLayoutData(data);
  }
Exemplo n.º 27
0
  /* (non-Javadoc)
   * @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory, org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection)
   */
  @Override
  public void createControl(
      Composite composite,
      TabbedPropertySheetWidgetFactory widgetFactory,
      ExtensibleGridPropertySection extensibleGridPropertySection) {
    SimulationTransition transition;
    if (((Activity) eObject).getLoopTransition() == null) {
      transition = SimulationFactory.eINSTANCE.createSimulationTransition();
      editingDomain
          .getCommandStack()
          .execute(
              new SetCommand(
                  editingDomain,
                  eObject,
                  SimulationPackage.Literals.SIMULATION_ACTIVITY__LOOP_TRANSITION,
                  transition));
    } else {
      transition = ((Activity) eObject).getLoopTransition();
    }

    composite.setLayout(new GridLayout(2, false));
    Composite radioComposite = widgetFactory.createComposite(composite);
    radioComposite.setLayout(new FillLayout());
    radioComposite.setLayoutData(GridDataFactory.fillDefaults().create());
    Button expressionRadio = widgetFactory.createButton(radioComposite, "Expression", SWT.RADIO);
    Button probaRadio = widgetFactory.createButton(radioComposite, "Probability", SWT.RADIO);

    final Composite stackComposite = widgetFactory.createComposite(composite);
    stackComposite.setLayoutData(GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).create());
    final StackLayout stackLayout = new StackLayout();
    stackComposite.setLayout(stackLayout);

    final Composite probaComposite = widgetFactory.createComposite(stackComposite);
    FillLayout layout = new FillLayout();
    layout.marginWidth = 10;
    probaComposite.setLayout(layout);
    Text probaText = widgetFactory.createText(probaComposite, "", SWT.BORDER);

    ControlDecoration controlDecoration = new ControlDecoration(probaText, SWT.LEFT | SWT.TOP);
    FieldDecoration fieldDecoration =
        FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    controlDecoration.setImage(fieldDecoration.getImage());
    controlDecoration.setDescriptionText(Messages.mustBeAPercentage);

    final Composite expressionComposite = widgetFactory.createComposite(stackComposite);
    FillLayout layout2 = new FillLayout();
    layout2.marginWidth = 10;
    expressionComposite.setLayout(layout2);
    ExpressionViewer expressionText =
        new ExpressionViewer(
            expressionComposite,
            SWT.BORDER,
            widgetFactory,
            editingDomain,
            SimulationPackage.Literals.SIMULATION_TRANSITION__EXPRESSION);
    Expression selection = transition.getExpression();
    if (selection == null) {
      selection = ExpressionFactory.eINSTANCE.createExpression();
      editingDomain
          .getCommandStack()
          .execute(
              SetCommand.create(
                  editingDomain,
                  transition,
                  SimulationPackage.Literals.SIMULATION_TRANSITION__EXPRESSION,
                  selection));
    }
    context.bindValue(
        ViewerProperties.singleSelection().observe(expressionText),
        EMFEditProperties.value(
                editingDomain, SimulationPackage.Literals.SIMULATION_TRANSITION__EXPRESSION)
            .observe(eObject));
    expressionText.setInput(eObject);

    boolean useExpression = transition.isUseExpression();
    if (useExpression) {
      stackLayout.topControl = expressionComposite;
    } else {
      stackLayout.topControl = probaComposite;
    }
    expressionRadio.setSelection(useExpression);
    probaRadio.setSelection(!useExpression);

    expressionRadio.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (((Button) e.getSource()).getSelection()) {
              stackLayout.topControl = expressionComposite;
            } else {
              stackLayout.topControl = probaComposite;
            }
            stackComposite.layout();
          }
        });

    context = new EMFDataBindingContext();
    context.bindValue(
        SWTObservables.observeSelection(expressionRadio),
        EMFEditObservables.observeValue(
            editingDomain,
            transition,
            SimulationPackage.Literals.SIMULATION_TRANSITION__USE_EXPRESSION));
    context.bindValue(
        SWTObservables.observeText(probaText, SWT.Modify),
        EMFEditObservables.observeValue(
            editingDomain,
            transition,
            SimulationPackage.Literals.SIMULATION_TRANSITION__PROBABILITY),
        new UpdateValueStrategy()
            .setConverter(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), false))
            .setAfterGetValidator(
                new WrappingValidator(
                    controlDecoration,
                    new StringToDoubleValidator(
                        StringToNumberConverter.toDouble(
                            BonitaNumberFormat.getPercentInstance(), false)))),
        new UpdateValueStrategy()
            .setConverter(
                NumberToStringConverter.fromDouble(
                    BonitaNumberFormat.getPercentInstance(), false)));
  }
Exemplo n.º 28
0
  /** Create the contents in the main composite. */
  protected void createMainContents() {
    if (displayTitle) {
      title = new TabbedPropertyTitle(mainComposite, factory);

      FormData data = new FormData();
      data.left = new FormAttachment(0, 0);
      if (displayCompactToolbar) {
        data.right = new FormAttachment(90, 0);
      } else {
        data.right = new FormAttachment(100, 0);
      }
      data.top = new FormAttachment(0, 0);
      title.setLayoutData(data);

      if (displayCompactToolbar) {
        toolBarComposite = new Composite(mainComposite, SWT.NONE);
        compactButton = new Button(toolBarComposite, SWT.PUSH);
        compactButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        compactButton.setToolTipText(
            Messages.getString(
                "TalendTabbedPropertyComposite.compactButton.toolTip")); //$NON-NLS-1$

        tableButton = new Button(toolBarComposite, SWT.PUSH);
        tableButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        tableButton.setToolTipText(
            Messages.getString("TalendTabbedPropertyComposite.tableButton.toolTip")); // $NON-NLS-1$

        if (isCompactView()) {
          compactButton.setImage(ImageProvider.getImage(EImage.COMPACT_VIEW));
          tableButton.setImage(ImageProvider.getImage(EImage.NO_TABLE_VIEW));
        } else {
          compactButton.setImage(ImageProvider.getImage(EImage.NO_COMPACT_VIEW));
          tableButton.setImage(ImageProvider.getImage(EImage.TABLE_VIEW));
        }

        Rectangle compactRectangle = compactButton.getBounds();
        tableButton.setBounds(compactRectangle);

        compactButton.setVisible(false);
        tableButton.setVisible(false);

        data = new FormData();
        data.left = new FormAttachment(title, 0);
        data.top = new FormAttachment(0, -5);
        toolBarComposite.setLayoutData(data);
        GridData gridData = new GridData();
        gridData.horizontalAlignment = SWT.RIGHT;
        gridData.verticalAlignment = SWT.TOP;
        compactButton.setData(gridData);
        tableButton.setData(gridData);

        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.horizontalSpacing = 0;
        layout.verticalSpacing = 0;
        layout.makeColumnsEqualWidth = true;
        toolBarComposite.setLayout(layout);
        toolBarComposite.setBackground(title.getBackground());
      }
    }

    leftComposite = factory.createComposite(mainComposite, SWT.NO_FOCUS);
    leftComposite.setLayout(new FormLayout());

    scrolledComposite =
        factory.createScrolledComposite(mainComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
    scrolledComposite.setLayout(new FormLayout());

    FormData formData = new FormData();
    formData.left = new FormAttachment(leftComposite, 0);
    formData.right = new FormAttachment(100, 0);
    if (displayTitle) {
      formData.top = new FormAttachment(title, 0);
    } else {
      formData.top = new FormAttachment(0, 0);
    }
    formData.bottom = new FormAttachment(100, 0);
    scrolledComposite.setLayoutData(formData);

    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(scrolledComposite, 0);
    if (displayTitle) {
      formData.top = new FormAttachment(title, 0);
    } else {
      formData.top = new FormAttachment(0, 0);
    }
    formData.bottom = new FormAttachment(100, 0);
    leftComposite.setLayoutData(formData);

    tabComposite = factory.createComposite(scrolledComposite, SWT.NO_FOCUS);
    tabComposite.setLayout(new FormLayout());
    tabComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

    scrolledComposite.setContent(tabComposite);
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);

    listComposite = new TalendTabbedPropertyList(leftComposite, factory);
    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    listComposite.setLayoutData(formData);

    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(100, 0);
    tabComposite.setLayoutData(data);
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    FormData data;

    inputButton = factory.createButton(composite, "Input?", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.top = new FormAttachment(composite, VSPACE * 2, SWT.BOTTOM);
    inputButton.setLayoutData(data);

    outputButton = factory.createButton(composite, "Output?", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(inputButton, HSPACE, SWT.RIGHT);
    data.top = new FormAttachment(inputButton, 0, SWT.TOP);
    outputButton.setLayoutData(data);

    multiportButton = factory.createButton(composite, "Multiport?", SWT.CHECK);
    data = new FormData();
    data.left = new FormAttachment(outputButton, HSPACE, SWT.RIGHT);
    data.top = new FormAttachment(outputButton, 0, SWT.TOP);
    multiportButton.setLayoutData(data);

    inputButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            PictogramElement pe = getSelectedPictogramElement();
            if (pe != null) {
              EObject port =
                  Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
              if (actorViewModel.isPort(port, null)) {
                setIoKind(
                    port, inputButton.getSelection(), actorViewModel.isPort(port, PortKind.OUTPUT));
              }
            }
          }
        });

    outputButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            PictogramElement pe = getSelectedPictogramElement();
            if (pe != null) {
              EObject port =
                  Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
              if (actorViewModel.isPort(port, null)) {
                setIoKind(
                    port, actorViewModel.isPort(port, PortKind.INPUT), outputButton.getSelection());
              }
            }
          }
        });

    multiportButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            PictogramElement pe = getSelectedPictogramElement();
            if (pe != null) {
              EObject port =
                  Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
              if (actorViewModel.isPort(port, null)) {
                setMultiport(port, multiportButton.getSelection());
              }
            }
          }
        });
  }
  /*
   * (non-Javadoc)
   *
   * @seeorg.bonitasoft.studio.common.properties.
   * IExtensibleGridPropertySectionContribution
   * #createControl(org.eclipse.swt.widgets.Composite,
   * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory,
   * org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection)
   */
  public void createControl(
      Composite mainComposite,
      TabbedPropertySheetWidgetFactory widgetFactory,
      ExtensibleGridPropertySection extensibleGridPropertySection) {

    this.widgetFactory = widgetFactory;
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    int col = 3;
    if (ModelHelper.isAnEntryPageFlowOnAPool(ModelHelper.getParentForm(element))) {
      col = 2;
    }
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());

    downloadOnly = widgetFactory.createButton(mainComposite, Messages.downloadOnly, SWT.CHECK);
    imagePreview = widgetFactory.createButton(mainComposite, Messages.previewAttachment, SWT.CHECK);
    widgetFactory.createLabel(mainComposite, "");

    final Composite radioComposite = widgetFactory.createComposite(mainComposite);
    radioComposite.setLayoutData(
        GridDataFactory.fillDefaults()
            .align(SWT.FILL, SWT.CENTER)
            .grab(true, false)
            .span(3, 1)
            .create());
    radioComposite.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(col).margins(0, 0).create());

    FileWidgetInputType initialInputType = createUseDocumentButton(widgetFactory, radioComposite);

    // createURLButton(widgetFactory, radioComposite);

    createUseResourceButton(radioComposite);

    initialValueSection =
        widgetFactory.createSection(mainComposite, Section.NO_TITLE | Section.CLIENT_INDENT);
    initialValueSection.setLayout(
        GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    initialValueSection.setLayoutData(
        GridDataFactory.fillDefaults().grab(true, true).span(3, 1).create());

    if (initialInputType == FileWidgetInputType.DOCUMENT) {
      initialValueSection.setClient(
          createInputExpressionComposite(initialValueSection, widgetFactory));
      /*}else if(initialInputType == FileWidgetInputType.URL){
      initialValueSection.setClient(createInputExpressionComposite(initialValueSection, widgetFactory));*/
    } else if (initialInputType == FileWidgetInputType.RESOURCE) {
      if (element.isDuplicate()) {
        initialValueSection.setClient(
            createMultipleResourceComposite(initialValueSection, widgetFactory));
      } else {
        initialValueSection.setClient(createResourceComposite(initialValueSection, widgetFactory));
      }
    }
    bindFields();

    if (initialInputType == FileWidgetInputType.DOCUMENT) {
      useDocumentButton.setSelection(true);
      useDocumentButton.notifyListeners(SWT.Selection, new Event());

      /*}else if(initialInputType == FileWidgetInputType.URL){
      useURLButton.setSelection(true);*/
    } else {
      useResourceButton.setSelection(true);
      useResourceButton.notifyListeners(SWT.Selection, new Event());
    }
  }