Exemplo n.º 1
0
  public void create() {
    label = new Label(parent, SWT.NULL);
    String labelText = type.getName();
    if (showValidationHint && useValidationGUIHints) {
      refontLabel(true);
    }
    label.setText(type.getName());

    Composite container = new Composite(parent, SWT.NULL);
    GridLayout contLayout = new GridLayout(3, false);
    contLayout.horizontalSpacing = 5;
    contLayout.marginLeft = 0;
    contLayout.marginWidth = 0;
    contLayout.marginHeight = 0;
    container.setLayout(contLayout);

    GridData containerLData = new GridData();
    containerLData.horizontalAlignment = GridData.FILL;
    containerLData.grabExcessHorizontalSpace = true;
    container.setLayoutData(containerLData);

    link = new Link(container, SWT.NONE);
    link.setToolTipText(this.type.getTooltiptext());
    link.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
    link.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            if (getHref() != null && getHref().length() > 0) Program.launch(getHref());
          }
        });

    Button editBtn = new Button(container, SWT.PUSH);
    editBtn.setText(Messages.getString("URLControl.1")); // $NON-NLS-1$
    editBtn.setToolTipText(this.type.getTooltiptext());
    editBtn.setEnabled(editable);
    editBtn.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }

          public void widgetDefaultSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }
        });

    setLinkText();
  }
Exemplo n.º 2
0
  public void create() {
    label = new Label(parent, SWT.NULL);

    label.setText(type.getName());

    Composite container = new Composite(parent, SWT.NULL);
    GridLayout contLayout = new GridLayout(2, false);
    contLayout.horizontalSpacing = 5;
    contLayout.marginLeft = 0;
    contLayout.marginWidth = 0;
    contLayout.marginHeight = 0;
    container.setLayout(contLayout);

    GridData containerLData = new GridData();
    containerLData.horizontalAlignment = GridData.FILL;
    containerLData.grabExcessHorizontalSpace = true;
    container.setLayoutData(containerLData);

    text = new Text(container, SWT.BORDER);
    text.setEditable(false);
    text.setToolTipText(this.type.getTooltiptext());
    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    bgColor = text.getBackground();
    fgColor = text.getForeground();

    Button editBtn = new Button(container, SWT.PUSH);
    editBtn.setText(Messages.MultiSelectionControl_1);
    editBtn.setToolTipText(this.type.getTooltiptext());
    editBtn.setEnabled(editable);
    editBtn.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent arg0) {
            showSelectionDialog();
          }

          public void widgetDefaultSelected(SelectionEvent arg0) {
            showSelectionDialog();
          }
        });

    // buttons not available for cnalink references
    if (crudButtons && !cnalinkreference) {
      // create buttons to add / delete new properties:
      Button addBtn = new Button(container, SWT.PUSH);
      addBtn.setText(Messages.MultiSelectionControl_2);
      addBtn.setEnabled(editable);
      addBtn.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent arg0) {
              showAddDialog();
            }

            public void widgetDefaultSelected(SelectionEvent arg0) {
              widgetSelected(arg0);
            }
          });
    }

    writeToTextField();
    if (showValidationHint && useValidationGUIHints) {
      refontLabel(true);
    }
  }