Example #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);
              }
            }
          }
        });
  }
  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);
  }
  /**
   * 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));
     */
  }
 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;
 }
  @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);
  }
  /**
   * 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);
  }