コード例 #1
0
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label label = new Label(composite, SWT.SHADOW_IN | SWT.LEFT);
    label.setText("Select dialog with specific layout: ");

    combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);

    for (LayoutType type : LayoutType.values()) {
      combo.add(type.toString());
    }

    combo.select(1);

    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    combo.setLayoutData(gridData);

    composite.pack();
    return composite;
  }
コード例 #2
0
 @Override
 protected void okPressed() {
   result = LayoutType.valueOf(combo.getText().substring(0, combo.getText().indexOf(" ")));
   super.okPressed();
 }