public void createControl(Composite parent) {
    int margin = Const.MARGIN;

    // create the composite to hold the widgets
    Composite composite = new Composite(parent, SWT.NONE);
    props.setLook(composite);

    FormLayout compLayout = new FormLayout();
    compLayout.marginHeight = Const.FORM_MARGIN;
    compLayout.marginWidth = Const.FORM_MARGIN;
    composite.setLayout(compLayout);

    wSourceDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    props.setLook(wSourceDB);
    for (int i = 0; i < databases.size(); i++) {
      DatabaseMeta dbInfo = databases.get(i);
      wSourceDB.add(dbInfo.getName());
    }
    fdSourceDB = new FormData();
    fdSourceDB.top = new FormAttachment(0, 0);
    fdSourceDB.left = new FormAttachment(0, 0);
    fdSourceDB.bottom = new FormAttachment(100, 0);
    fdSourceDB.right = new FormAttachment(50, 0);
    wSourceDB.setLayoutData(fdSourceDB);
    wSourceDB.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            setPageComplete(false);
          }
        });

    wTargetDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    props.setLook(wTargetDB);
    for (int i = 0; i < databases.size(); i++) {
      DatabaseMeta dbInfo = databases.get(i);
      wTargetDB.add(dbInfo.getName());
    }
    fdTargetDB = new FormData();
    fdTargetDB.top = new FormAttachment(0, 0);
    fdTargetDB.left = new FormAttachment(50, margin);
    fdTargetDB.bottom = new FormAttachment(100, 0);
    fdTargetDB.right = new FormAttachment(100, 0);
    wTargetDB.setLayoutData(fdTargetDB);
    wTargetDB.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            setPageComplete(false);
          }
        });

    // set the composite as the control for this page
    setControl(composite);
  }
  public void createControl(Composite parent) {
    selectedPermissions = new ArrayList<RoleData>();
    GridData gd;
    Composite container = new Composite(parent, SWT.NULL);
    checkBoxes = new ArrayList<Button>();
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 1;
    layout.verticalSpacing = 10;
    gd = new GridData(GridData.FILL_HORIZONTAL);
    try {
      loadData();
    } catch (RemoteException e) {
      log.error(e);
    } catch (Exception e) {
      log.error(e);
    }
    for (int i = 0; i < permissionList.length; i++) {
      if (roleData != null) {
        createCheckbox(permissionList[i], gd, container, i, roleData);
      }
    }

    gd = new GridData(GridData.FILL_HORIZONTAL);
    Label label = new Label(container, SWT.NULL);
    label.setText("Selected Resource paths");
    label.setLayoutData(gd);
    list = new List(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    gd = new GridData(GridData.FILL_BOTH);
    list.setLayoutData(gd);
    selectedIemList = new ArrayList<RegistryResourceNode>();
    fillTextArea(selectedIemList);
    setControl(container);
  }
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    composite.setLayout(layout);
    setControl(composite);

    final List lst = new List(composite, SWT.BORDER);
    lst.setItems(names);
    lst.setLayoutData(new GridData(GridData.FILL_BOTH));
    lst.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent e) {
            int sel = lst.getSelectionIndex();
            // recall that we are using TRANSLATED names!
            calculation =
                (CalculationEnum)
                    EnumHelper.getEnumByTranslatedName(CalculationEnum.values(), names[sel]);
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    lst.setSelection(0);

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(getControl(), "Jaspersoft.wizard"); // $NON-NLS-1$
  }
Beispiel #4
0
  @Override
  protected Control createContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);

    GridLayout gridLayout = new GridLayout(2, false);

    container.setLayout(gridLayout);

    // Initialize and populate list
    final List list = new List(container, SWT.NONE);
    list.setLayoutData(new GridData(SWT.FILL));
    populateList(list);
    list.setSelection(0);
    list.setSize(10, 20);
    list.addSelectionListener(new SomeSelectionListener(list));

    Composite selectorContainer = new Composite(container, SWT.NONE);
    selectorContainer.setLayout(new GridLayout(1, false));

    // Add color editor
    Composite colorContainer = new Composite(selectorContainer, SWT.NONE);
    color = new ColorFieldEditor(SYNTAXCOLOR_COLOR + SYNTAXCOLOR_KEYWORD, "Color", colorContainer);

    // Create and add style group
    Group styleContainer = new Group(selectorContainer, SWT.NONE);
    styleContainer.setText("Style");

    GridLayout gridLayout2 = new GridLayout(1, false);
    styleContainer.setLayout(gridLayout2);

    Composite styleBoldContainer = new Composite(styleContainer, SWT.NONE);
    Composite styleItalicContainer = new Composite(styleContainer, SWT.NONE);
    Composite styleUnderlineContainer = new Composite(styleContainer, SWT.NONE);
    Composite styleStrikethroughContainer = new Composite(styleContainer, SWT.NONE);

    styleBold =
        new BooleanFieldEditor(SYNTAXCOLOR_BOLD + SYNTAXCOLOR_KEYWORD, "Bold", styleBoldContainer);
    styleItalic =
        new BooleanFieldEditor(
            SYNTAXCOLOR_ITALIC + SYNTAXCOLOR_KEYWORD, "Italic", styleItalicContainer);
    styleUnderline =
        new BooleanFieldEditor(
            SYNTAXCOLOR_UNDERLINE + SYNTAXCOLOR_KEYWORD, "Underline", styleUnderlineContainer);
    styleStrikethrough =
        new BooleanFieldEditor(
            SYNTAXCOLOR_STRIKETHROUGH + SYNTAXCOLOR_KEYWORD,
            "Strike through",
            styleStrikethroughContainer);

    // Link editors with the default preferenceStore
    color.setPreferenceStore(getDefaultPreferenceStore());
    styleBold.setPreferenceStore(getDefaultPreferenceStore());
    styleItalic.setPreferenceStore(getDefaultPreferenceStore());
    styleUnderline.setPreferenceStore(getDefaultPreferenceStore());
    styleStrikethrough.setPreferenceStore(getDefaultPreferenceStore());

    // Load values for keyword
    updateEditors(SYNTAXCOLOR_KEYWORD);
    return container;
  }
Beispiel #5
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText("PYTHONPATH that will be used in the run:");
    fPythonPathList = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);

    GridData gd = new GridData(GridData.FILL_BOTH);
    fPythonPathList.setLayoutData(gd);
  }
  @Override
  public void createControl(Composite parent) {
    Composite controls = new Composite(parent, SWT.FILL);
    controls.setLayout(new FormLayout());

    Label label = new Label(controls, SWT.LEFT);
    label.setText("Available launch configurations: ");
    FormData f = new FormData();
    f.left = new FormAttachment(0, 5);
    f.top = new FormAttachment(0, 5);
    label.setLayoutData(f);

    availableConfigsCombo = new Combo(controls, SWT.LEFT | SWT.READ_ONLY);
    f = new FormData();
    f.left = new FormAttachment(label, 5);
    f.right = new FormAttachment(100, -100);
    f.top = new FormAttachment(0, 5);
    availableConfigsCombo.setLayoutData(f);

    add = new Button(controls, SWT.PUSH);
    add.setText("Add");
    add.setEnabled(false);
    f = new FormData();
    f.left = new FormAttachment(availableConfigsCombo, 5);
    f.right = new FormAttachment(100, -5);
    f.top = new FormAttachment(0, 4);
    add.setLayoutData(f);

    Label selectiosLabel = new Label(controls, SWT.LEFT);
    f = new FormData();
    f.left = new FormAttachment(0, 5);
    f.top = new FormAttachment(availableConfigsCombo, 5);
    selectiosLabel.setLayoutData(f);

    selectiosLabel.setText("Selected launch configurations:");
    selectedConfigsList =
        new org.eclipse.swt.widgets.List(
            controls, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    f = new FormData();
    f.left = new FormAttachment(label, 5);
    f.right = new FormAttachment(100, -5);
    f.top = new FormAttachment(availableConfigsCombo, 5);
    f.bottom = new FormAttachment(100, -35);
    selectedConfigsList.setLayoutData(f);

    delete = new Button(controls, SWT.PUSH);
    delete.setText("Remove");
    f = new FormData();
    f.left = new FormAttachment(100, -100);
    f.right = new FormAttachment(100, -5);
    f.top = new FormAttachment(selectedConfigsList, 5);
    delete.setLayoutData(f);
    delete.setEnabled(false);

    addListenerrs();
    setControl(controls);
  }
  /**
   * Create contents of the dialog
   *
   * @param parent
   */
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    container.setLayout(gridLayout);

    final Label label = new Label(container, SWT.NONE);
    label.setText("查找:");

    text = new Text(container, SWT.BORDER);
    text.addModifyListener(
        new ModifyListener() {
          public void modifyText(final ModifyEvent e) {
            searchCondition = text.getText();
            StructuredSelection sel = (StructuredSelection) listViewer.getSelection();
            Object selObj = sel.isEmpty() ? null : sel.getFirstElement();
            listViewer.refresh();
            if (selObj != null) {
              sel = new StructuredSelection(selObj);
              listViewer.setSelection(sel);
            }
          }
        });
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    listViewer = new ListViewer(container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    listViewer.setContentProvider(new ListContentProvider());
    list = listViewer.getList();
    list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    listViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(final DoubleClickEvent event) {
            StructuredSelection sel = (StructuredSelection) event.getSelection();
            if (sel.isEmpty()) {
              return;
            }
            buttonPressed(IDialogConstants.OK_ID);
          }
        });
    listViewer.setInput(ProjectData.getActiveProject());

    List<SkillConfig> selObjs = new ArrayList<SkillConfig>();
    for (int id : selectedSkills) {
      try {
        SkillConfig q =
            (SkillConfig) ProjectData.getActiveProject().findObject(SkillConfig.class, id);
        if (q != null) {
          selObjs.add(q);
        }
      } catch (Exception e) {
      }
    }
    StructuredSelection sel = new StructuredSelection(selObjs);
    listViewer.setSelection(sel);

    return container;
  }
 /** Method for creating a list */
 protected void createList(
     int horizontalSpan, int verticalSpan, int widthHint, int numberOfItems) {
   entityList = new List(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.HORIZONTAL);
   GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
   gridData.verticalSpan = verticalSpan;
   gridData.horizontalSpan = horizontalSpan;
   gridData.heightHint = entityList.getItemHeight() * numberOfItems;
   gridData.widthHint = widthHint;
   entityList.setLayoutData(gridData);
 }
  public void createControl(Composite parent) {
    Composite composite = PlatformUtils.createComposite(parent, 1);
    new Label(composite, SWT.NONE).setText(Messages.getString("select.version")); // $NON-NLS-1$

    versions = new List(composite, SWT.BORDER | SWT.MULTI);
    versions.setLayoutData(new GridData(GridData.FILL_BOTH));
    populateVersions();

    super.setControl(composite);
  }
Beispiel #10
0
  void createPopup(String[] items, int selectionIndex) {
    // create shell and list
    popup = new AlphaDialog(getShell(), SWT.NO_TRIM | SWT.ON_TOP | SWT.BORDER);
    popup.setBackgroundMode(SWT.INHERIT_DEFAULT);
    Color borderColor = ColorCache.getInstance().getColor(200, 200, 200);
    popup.setBackground(borderColor);

    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginBottom = 1;
    gridLayout.marginTop = 0;
    gridLayout.marginLeft = 0;
    gridLayout.marginRight = 0;

    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    popup.getPopup().setLayout(gridLayout);

    int style = getStyle();
    int listStyle = SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER;
    if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
    if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
    if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
    list = new List(popup.getPopup(), listStyle);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    list.setLayoutData(gridData);
    list.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 3) {
              text.getMenu().setVisible(true);
            }
            if (list.isFocusControl()) return;
            text.forceFocus();
            list.setFocus();
          }
        });

    if (font != null) list.setFont(font);
    if (foreground != null) list.setForeground(foreground);
    if (background != null) list.setBackground(background);

    int[] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
    for (int i = 0; i < popupEvents.length; i++)
      popup.getPopup().addListener(popupEvents[i], listener);
    int[] listEvents = {
      SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose
    };
    for (int i = 0; i < listEvents.length; i++) list.addListener(listEvents[i], listener);

    if (items != null) list.setItems(items);
    if (selectionIndex != -1) list.setSelection(selectionIndex);
  }
  private Control createDialogAreaContentsForLoad(Composite p_composite) {
    messageLabel = new Label(p_composite, SWT.NULL);
    messageLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text1")); // $NON-NLS-1$
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    gd.widthHint = 400;
    messageLabel.setLayoutData(gd);
    Label nameLabel = new Label(p_composite, SWT.NULL);
    nameLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.nameLabel.text2")); // $NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);
    nameList = new List(p_composite, SWT.V_SCROLL);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.heightHint = 100;
    nameList.setLayoutData(gd);
    nameList.setItems(QuickRExPlugin.getDefault().getTestTextNames());
    nameList.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            if (nameList.getSelection() != null && nameList.getSelection().length > 0) {
              testTextField.setText(
                  QuickRExPlugin.getDefault()
                      .getTestTextByName(nameList.getSelection()[0])
                      .getText());
              selectedPath = null;
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    Label textLabel = new Label(p_composite, SWT.NULL);
    textLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.textLabel.text2")); // $NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    textLabel.setLayoutData(gd);
    testTextField =
        new Text(
            p_composite,
            SWT.READ_ONLY | SWT.LEAD | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RESIZE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 250;
    gd.widthHint = 400;
    testTextField.setLayoutData(gd);
    testTextField.setBackground(new Color(getShell().getDisplay(), new RGB(255, 255, 255)));
    return p_composite;
  }
  private void addProfilesSection(Composite parent) {
    Label profilesLabel = new Label(parent, SWT.NONE);
    profilesLabel.setText(PROFILES_TITLE);

    Composite composite = createColComposite(parent);

    GridData listGd = new GridData();
    listGd.heightHint = convertHeightInCharsToPixels(6);
    listGd.widthHint = convertWidthInCharsToPixels(LIST_FIELD_WIDTH);

    availableProfilesList = new List(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    availableProfilesList.setLayoutData(listGd);

    Composite buttonComposite = new Composite(composite, SWT.NULL);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.numColumns = 1;
    buttonComposite.setLayout(buttonLayout);

    GridData buttonGd = new GridData();
    buttonComposite.setLayoutData(buttonGd);

    Button addButton = new Button(buttonComposite, SWT.PUSH);
    addButton.setText(">>");

    addProfilesListener(addButton);

    Button removeButton = new Button(buttonComposite, SWT.PUSH);
    removeButton.setText("<<");

    removeProfilesListener(removeButton);

    profilesList = new List(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    profilesList.setLayoutData(listGd);
    profilesList.setItems(config.getProfiles());
    availableProfilesList.setItems(getAvailableProfiles());

    Button importButton = new Button(parent, SWT.PUSH);
    importButton.setText("import selected profiles");

    importProfilesListener(importButton);
  }
 /**
  * Create a text field specific for this application
  *
  * @param parent the parent of the new text field
  * @return the new text field
  */
 private List createList(Composite parent) {
   List list = new List(parent, SWT.MULTI | SWT.BORDER);
   list.addSelectionListener(this);
   GridData data = new GridData();
   data.horizontalSpan = 2;
   data.horizontalAlignment = GridData.FILL;
   data.grabExcessHorizontalSpace = true;
   data.verticalAlignment = GridData.CENTER;
   data.grabExcessVerticalSpace = false;
   list.setLayoutData(data);
   return list;
 }
 /**
  * 初始化已保存的条件列表
  *
  * @param comp 父容器
  */
 private void initCustomFilterList(Composite comp) {
   customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
   customFilterList.setLayoutData(new GridData(GridData.FILL_BOTH));
   setListData(customFilterList, customFilters);
   customFilterList.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseDoubleClick(MouseEvent e) {
           // 调编辑的方法
           edit();
         }
       });
 }
  /** Overrides the dialog box. Prompts the user for what features to select. */
  @Override
  protected Control createDialogArea(Composite parent) {
    // The composite for the dialog box
    Composite independentVarSelection = (Composite) super.createDialogArea(parent);
    independentVarSelection.setLayout(new GridLayout(1, true));
    independentVarSelection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    // Checks that a list of features was set for the user to select from
    if (featureList != null) {
      // Label to prompt the user to select an X and a Y
      Label headerLabel = new Label(independentVarSelection, SWT.FILL);
      headerLabel.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
      headerLabel.setText(
          "Select independent variables for " + source + "\n(Ctrl-click to select multiple)");

      // The list for the X features
      final List independentFeatureList =
          new List(independentVarSelection, SWT.V_SCROLL | SWT.BORDER | SWT.H_SCROLL | SWT.MULTI);
      independentFeatureList.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));

      for (String feature : featureList) {
        independentFeatureList.add(feature);
      }

      // The listener for the xFeatureList which sets what the user
      // selected to xAxisFeature
      independentFeatureList.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
              independentVariables.clear();
              String[] selection = independentFeatureList.getSelection();
              for (int i = 0; i < selection.length; i++) {
                independentVariables.add(selection[i]);
              }
            }
          });

      // Select the first item by default.
      if (!featureList.isEmpty()) {
        independentFeatureList.setSelection(0);
        independentVariables.add(featureList.get(0));
      }
    }

    return independentVarSelection;
  }
Beispiel #16
0
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite comp = new Composite(parent, SWT.NULL);
    comp.setFont(parent.getFont());
    comp.setLayout(new GridLayout(1, true));
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create the converters list group area
    final Group convertersListGroup = new Group(comp, SWT.NONE);
    convertersListGroup.setFont(parent.getFont());
    convertersListGroup.setText(Messages.ProjectConvert_convertersList);
    convertersListGroup.setLayout(new GridLayout(1, false));
    convertersListGroup.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create the current config List
    convertersList =
        new org.eclipse.swt.widgets.List(
            convertersListGroup, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    convertersList.setFont(convertersListGroup.getFont());
    GridData data = new GridData(GridData.FILL_BOTH);
    convertersList.setLayoutData(data);
    convertersList.addDisposeListener(
        new DisposeListener() {
          @Override
          public void widgetDisposed(DisposeEvent event) {
            convertersList = null;
          }
        });
    convertersList.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event e) {
            validateState();
          }
        });
    Object[] objs = getConversionElements().keySet().toArray();
    String[] names = new String[objs.length];
    for (int i = 0; i < objs.length; i++) {
      Object object = objs[i];
      names[i] = (String) object;
    }
    convertersList.setItems(names);
    validateState();
    return comp;
  }
 void createAvailableTypes(Composite parent) {
   final List list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
   GridData data = new GridData(GridData.FILL_BOTH);
   data.heightHint = 100;
   list.setLayoutData(data);
   Button b = new Button(parent, SWT.PUSH);
   b.setText("Get Available Types");
   b.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) {
           list.removeAll();
           String[] names = clipboard.getAvailableTypeNames();
           for (int i = 0; i < names.length; i++) {
             list.add(names[i]);
           }
         }
       });
 }
Beispiel #18
0
  /**
   * @param parent
   * @param style
   */
  public ProductTypeSelectorListImpl(Composite parent, int style) {
    super(parent, style, LayoutMode.TIGHT_WRAPPER);

    productLabel = new Label(this, SWT.NONE);
    productLabel.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.admin.ui.gridpriceconfig.ProductTypeSelectorListImpl.productTypeLabel.text")); //$NON-NLS-1$
    productTypeGUIList = new List(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData productListLayoutData = new GridData(GridData.FILL_BOTH);
    productTypeGUIList.setLayoutData(productListLayoutData);
    productTypeGUIList.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            fireSelectionChangedEvent();
          }
        });
  }
  public void createControl(Composite parent) {
    Composite composite = createComposite(parent, 1);
    new Label(composite, SWT.NONE)
        .setText("This wizard allow you to check out resource from a Guvnor repository");

    createRep = new Button(composite, SWT.RADIO);
    createRep.setText("Create a new Guvnor repository location");
    createRep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    createRep.setSelection(false);
    createRep.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            repLocations.setEnabled(existingRep.getSelection());
          }
        });

    existingRep = new Button(composite, SWT.RADIO);
    existingRep.setText("Use an existing Guvnor repository location");
    existingRep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    existingRep.setSelection(true);
    existingRep.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            repLocations.setEnabled(existingRep.getSelection());
          }
        });

    repLocations = new List(composite, SWT.BORDER | SWT.MULTI);
    repLocations.setLayoutData(new GridData(GridData.FILL_BOTH));
    repLocations.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            updateModel();
          }
        });
    addRepositoryList();
    super.setControl(composite);
  }
  private void createSection(Composite parent) {
    // create compiler selection
    Composite field = new Composite(parent, SWT.NONE);
    field.setLayout(new GridLayout(2, false));
    compilerList = new List(field, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
    GridData listgd = new GridData();
    listgd.heightHint = 80;
    compilerList.setLayoutData(listgd);

    compilerList.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            int idx = compilerList.getSelectionIndex();
            changeSelection(idx);
          }
        });

    createButtons(field);
  }
  private void createSelectedListBox(Composite parent) {
    selectedListBox = new List(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    selectedListBox.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent event) {}

          public void widgetSelected(SelectionEvent event) {

            if (selectedListBox.getSelectionCount() > 0) setRemoveButtonEnabled(true);
            else setRemoveButtonEnabled(false);
            return;
          }
        });

    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = SIZING_LISTS_WIDTH;
    gd.heightHint = SIZING_LISTS_HEIGHT;
    selectedListBox.setLayoutData(gd);
  }
  /*
   * (non-) Method declared on FieldEditor.
   */
  @Override
  protected void doFillIntoGrid(Composite parent, int numColumns) {
    Control control = getLabelControl(parent);
    GridData gd = new GridData();
    gd.horizontalSpan = numColumns;
    control.setLayoutData(gd);

    list = getListControl(parent);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = heightHint;
    gd.verticalAlignment = GridData.FILL;
    gd.horizontalSpan = numColumns - 1;
    gd.grabExcessHorizontalSpace = true;
    list.setLayoutData(gd);

    buttonBox = getButtonBoxControl(parent);
    gd = new GridData();
    gd.verticalAlignment = GridData.BEGINNING;
    buttonBox.setLayoutData(gd);
  }
  protected Composite getMainPanel(Composite parent) {
    if (mainPanel == null) {
      mainPanel = new Composite(parent, SWT.NONE);
      GridLayout layout = new GridLayout(2, false);
      layout.marginWidth = 0;
      mainPanel.setLayout(layout);

      list = createListControl(mainPanel);
      GridData gd = new GridData(GridData.FILL_BOTH);
      // gd.verticalAlignment = GridData.FILL;
      //			gd.horizontalSpan = numColumns - 1;
      gd.grabExcessHorizontalSpace = true;
      list.setLayoutData(gd);

      buttonBox = getButtonBoxControl(mainPanel);
      gd = new GridData();
      gd.verticalAlignment = GridData.BEGINNING;
      buttonBox.setLayoutData(gd);
      updateSelectionDependentActions();
    } else checkParent(mainPanel, parent);
    return mainPanel;
  }
  private void createIgnoreRangesControls(Composite top) {

    ignoreRangesList = new List(top, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    FontMetrics fm = MemcheckPlugin.getFontMetrics(ignoreRangesList);
    ignoreRangesList.setLayoutData(
        new GridData(
            Dialog.convertWidthInCharsToPixels(fm, 50),
            Dialog.convertHeightInCharsToPixels(fm, 5)));

    Composite ignoreButtons = new Composite(top, SWT.NONE);
    GridLayout ignoreButtonsLayout = new GridLayout();
    ignoreButtonsLayout.marginWidth = ignoreButtonsLayout.marginHeight = 0;
    ignoreButtons.setLayout(ignoreButtonsLayout);
    ignoreButtons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    Button newButton = new Button(ignoreButtons, SWT.PUSH);
    newButton.setText(Messages.getString("MemcheckToolPage.New")); // $NON-NLS-1$
    newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleIgnoreNewButtonPressed();
            updateLaunchConfigurationDialog();
          }
        });

    Button removeButton = new Button(ignoreButtons, SWT.PUSH);
    removeButton.setText(Messages.getString("MemcheckToolPage.Remove")); // $NON-NLS-1$
    removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    removeButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleIgnoreRemoveButtonPressed();
            updateLaunchConfigurationDialog();
          }
        });
  }
 protected Composite createArea(Composite parent) {
   parent = new Composite(parent, SWT.NONE);
   parent.setLayout(new GridLayout());
   parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
   list = new List(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.grabExcessHorizontalSpace = true;
   gd.grabExcessVerticalSpace = true;
   gd.widthHint = 250;
   gd.minimumHeight = 100;
   list.setLayoutData(gd);
   list.addDisposeListener(
       new DisposeListener() {
         public void widgetDisposed(DisposeEvent e) {
           if (clipboard != null) {
             clipboard.dispose();
           }
         }
       });
   list.addSelectionListener(
       new SelectionAdapter() {
         /*
          * (non-Javadoc)
          *
          * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
          */
         public void widgetSelected(SelectionEvent e) {
           list.selectAll();
           super.widgetSelected(e);
         }
       });
   createDNDSource();
   createCopyAction(parent);
   Dialog.applyDialogFont(parent);
   return parent;
 }
Beispiel #26
0
  /** @wbp.parser.entryPoint */
  private void createComposite(Composite parent) {
    mainComposite = new Composite(parent, SWT.BORDER);
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    mainComposite.setLayout(new GridLayout(3, false));

    chkSegmentSource = new Button(mainComposite, SWT.CHECK);
    chkSegmentSource.setText("Segment the source text using the following SRX rules:");
    GridData gdTmp = new GridData();
    gdTmp.horizontalSpan = 3;
    chkSegmentSource.setLayoutData(gdTmp);
    chkSegmentSource.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateSourceDisplay();
            updateOptionsDisplay();
          }
        });

    edSourceSRX = new Text(mainComposite, SWT.BORDER);
    edSourceSRX.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    btGetSourceSRX = new Button(mainComposite, SWT.PUSH);
    btGetSourceSRX.setText("...");
    btGetSourceSRX.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            getSRXFile(edSourceSRX);
          }
        });

    btEditSourceSRX = new Button(mainComposite, SWT.PUSH);
    btEditSourceSRX.setText("Edit...");
    btEditSourceSRX.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            editSRXFile(edSourceSRX);
          }
        });

    chkSegmentTarget = new Button(mainComposite, SWT.CHECK);
    chkSegmentTarget.setText("Segment existing target text using the following SRX rules:");
    gdTmp = new GridData();
    gdTmp.horizontalSpan = 3;
    chkSegmentTarget.setLayoutData(gdTmp);
    chkSegmentTarget.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateTargetDisplay();
            updateOptionsDisplay();
          }
        });

    edTargetSRX = new Text(mainComposite, SWT.BORDER);
    edTargetSRX.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    btGetTargetSRX = new Button(mainComposite, SWT.PUSH);
    btGetTargetSRX.setText("...");
    btGetTargetSRX.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            getSRXFile(edTargetSRX);
          }
        });

    btEditTargetSRX = new Button(mainComposite, SWT.PUSH);
    btEditTargetSRX.setText("Edit...");
    btEditTargetSRX.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            editSRXFile(edTargetSRX);
          }
        });

    grpOptions = new Group(mainComposite, SWT.NONE);
    grpOptions.setText("Options");
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    gdTmp.horizontalSpan = 3;
    grpOptions.setLayoutData(gdTmp);
    grpOptions.setLayout(new GridLayout(1, false));

    lblBehaviorForSegmented = new Label(grpOptions, SWT.NONE);
    lblBehaviorForSegmented.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblBehaviorForSegmented.setText("Behavior if input text is already segmented:");

    listBehaviorForSegmented = new List(grpOptions, SWT.BORDER);
    listBehaviorForSegmented.setItems(
        new String[] {
          "Keep existing segmentation",
          "Overwrite existing segmentation (resegment)",
          "Keep existing segmentation, segment further against the SRX rules"
        });
    listBehaviorForSegmented.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    chkCopySource = new Button(grpOptions, SWT.CHECK);
    chkCopySource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    chkCopySource.setText("Copy source into target if no  target exists");

    chkCheckSegments = new Button(grpOptions, SWT.CHECK);
    chkCheckSegments.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    chkCheckSegments.setText(
        "Verify that a target segment matches each source segment when a target content exists");

    chkForceSegmentedOutput = new Button(grpOptions, SWT.CHECK);
    chkForceSegmentedOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    chkForceSegmentedOutput.setText("When possible force the output to show the segmentation");
  }
 public void setLayoutData(GridData gridData) {
   listIntermediary.setLayoutData(gridData);
 }
  public void createPartControl(Composite parent) {
    // TODO Auto-generated method stub
    GridData gridData9 = new org.eclipse.swt.layout.GridData();
    gridData9.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData9.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData8 = new org.eclipse.swt.layout.GridData();
    gridData8.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData8.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
    GridData gridData7 = new org.eclipse.swt.layout.GridData();
    gridData7.horizontalSpan = 3;
    gridData7.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
    gridData7.grabExcessHorizontalSpace = true;
    gridData7.grabExcessVerticalSpace = true;
    gridData7.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridData gridData61 = new org.eclipse.swt.layout.GridData();
    gridData61.horizontalSpan = 3;
    gridData61.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData61.grabExcessHorizontalSpace = true;
    gridData61.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridData gridData11 = new org.eclipse.swt.layout.GridData();
    gridData11.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
    gridData11.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData32 = new org.eclipse.swt.layout.GridData();
    gridData32.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
    gridData32.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData2 = new org.eclipse.swt.layout.GridData();
    gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData2.grabExcessHorizontalSpace = false;
    gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData12 = new org.eclipse.swt.layout.GridData();
    gridData12.horizontalSpan = 2;
    gridData12.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData12.grabExcessHorizontalSpace = true;
    gridData12.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridData gridData6 = new org.eclipse.swt.layout.GridData();
    gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData5 = new org.eclipse.swt.layout.GridData();
    gridData5.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData5.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData4 = new org.eclipse.swt.layout.GridData();
    gridData4.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData4.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData31 = new org.eclipse.swt.layout.GridData();
    gridData31.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
    gridData31.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    GridData gridData1 = new org.eclipse.swt.layout.GridData();
    gridData1.horizontalSpan = 3;
    gridData1.grabExcessHorizontalSpace = true;
    gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridData gridData = new org.eclipse.swt.layout.GridData();
    gridData.horizontalSpan = 3;
    gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;
    top = new Composite(parent, SWT.V_SCROLL);
    top.setToolTipText("");
    top.setLayout(gridLayout);

    label = new Label(top, SWT.NONE);
    label.setText("Name");
    textName = new Text(top, SWT.BORDER);
    textName.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            sqlPredicate.setName(textName.getText());
            updateModel();
          }
        });
    textName.setLayoutData(gridData);

    label1 = new Label(top, SWT.NONE);
    label1.setText("Query(SELECT Statement):");
    textQuery = new Text(top, SWT.BORDER);
    textQuery.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            sqlPredicate.setQuery(textQuery.getText());
          }
        });
    textQuery.setLayoutData(gridData1);

    label2 = new Label(top, SWT.NONE);
    label2.setText("Type Mapping Class");
    rbDefault = new Button(top, SWT.RADIO);
    rbDefault.setText("Default");
    rbDefault.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            sqlPredicate.setTypeMapping(new DefaultTypeMapping());
            textClass.setEnabled(false);
            buttonBrowse.setEnabled(false);
          }
        });
    rbMeta = new Button(top, SWT.RADIO);
    rbMeta.setText("Use Meta Data");
    rbMeta.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            sqlPredicate.setTypeMapping(null);
            textClass.setEnabled(false);
            buttonBrowse.setEnabled(false);
          }
        });
    label.setLayoutData(gridData6);
    label1.setLayoutData(gridData5);
    label2.setLayoutData(gridData4);
    rbCustom = new Button(top, SWT.RADIO);
    label3 = new Label(top, SWT.NONE);
    label3.setText("Type Mapping Class");
    label3.setLayoutData(gridData31);

    textClass = new Text(top, SWT.BORDER);
    textClass.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            Class clazz = (Class) textClass.getData();
            SQLTypeMapping map;
            try {
              map = clazz == null ? null : ((SQLTypeMapping) (clazz.newInstance()));
              sqlPredicate.setTypeMapping(map);

            } catch (InstantiationException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            } catch (IllegalAccessException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    textClass.setLayoutData(gridData12);
    buttonBrowse = new Button(top, SWT.NONE);
    rbCustom.setText("Custom");
    rbCustom.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            textClass.setEnabled(true);
            buttonBrowse.setEnabled(true);
          }
        });
    rbCustom.setLayoutData(gridData11);
    rbCustom.setLayoutData(gridData32);
    label8 = new Label(top, SWT.NONE);
    label8.setText("Current Data Source:");
    label8.setLayoutData(gridData9);
    labelCurrentDS = new Label(top, SWT.BORDER);
    labelCurrentDS.setText("");
    labelCurrentDS.setBackground(new Color(Display.getDefault(), 255, 255, 255));
    labelCurrentDS.setLayoutData(gridData61);
    label6 = new Label(top, SWT.NONE);
    label6.setText("Data Sources:");
    label6.setLayoutData(gridData8);
    list = new List(top, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    list.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            sqlPredicate.setDataSource(
                (DataSource) (list.getData(list.getItem(list.getSelectionIndex()))));
            labelCurrentDS.setText(list.getItem(list.getSelectionIndex()));
          }
        });
    list.setLayoutData(gridData7);
    buttonBrowse.setText("Browse..");
    buttonBrowse.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            ClassSelectorDialog dialog =
                new ClassSelectorDialog(
                    getSite().getShell(),
                    ClassFilter.exclusiveConcreteSubclasses(SQLTypeMapping.class),
                    null,
                    null);
            dialog.create();
            dialog.initialize();
            if (dialog.open() != InputDialog.OK) return;
            textClass.setData(dialog.getSelectedClass());
            textClass.setText(dialog.getSelectedClass().toString());
          }
        });
    buttonBrowse.setLayoutData(gridData2);

    makeActions();

    contributeToActionBars();
    getViewSite().getPage().addSelectionListener(this);
  }
  private void createLanguagesGroup(Composite parent) {
    final Group langGroup =
        NSISWizardDialogUtil.createGroup(
            parent, 1, "language.support.group.label", null, false); // $NON-NLS-1$
    GridData data = (GridData) langGroup.getLayoutData();
    data.verticalAlignment = SWT.FILL;
    data.grabExcessVerticalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    data.grabExcessHorizontalSpace = true;

    NSISWizardSettings settings = mWizard.getSettings();

    final Button enableLangSupport =
        NSISWizardDialogUtil.createCheckBox(
            langGroup,
            "enable.language.support.label",
            settings.isEnableLanguageSupport(),
            true,
            null,
            false); //$NON-NLS-1$
    enableLangSupport.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            boolean selection = enableLangSupport.getSelection();
            mWizard.getSettings().setEnableLanguageSupport(selection);
            validateField(LANG_CHECK);
          }
        });

    final MasterSlaveController m = new MasterSlaveController(enableLangSupport);

    final Composite listsComposite = new Composite(langGroup, SWT.NONE);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    listsComposite.setLayoutData(data);

    GridLayout layout = new GridLayout(2, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    listsComposite.setLayout(layout);

    java.util.List<NSISLanguage> selectedLanguages = settings.getLanguages();
    if (selectedLanguages.isEmpty()) {
      NSISLanguage defaultLanguage = NSISLanguageManager.getInstance().getDefaultLanguage();
      if (defaultLanguage != null) {
        selectedLanguages.add(defaultLanguage);
      }
    }
    java.util.List<NSISLanguage> availableLanguages =
        NSISLanguageManager.getInstance().getLanguages();
    availableLanguages.removeAll(selectedLanguages);

    Composite leftComposite = new Composite(listsComposite, SWT.NONE);
    leftComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    leftComposite.setLayout(layout);

    ((GridData)
                NSISWizardDialogUtil.createLabel(
                        leftComposite,
                        "available.languages.label", //$NON-NLS-1$
                        true,
                        m,
                        false)
                    .getLayoutData())
            .horizontalSpan =
        2;

    final List availableLangList =
        new List(leftComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    Dialog.applyDialogFont(availableLangList);
    data.heightHint = Common.calculateControlSize(availableLangList, 0, 12).y;
    availableLangList.setLayoutData(data);
    m.addSlave(availableLangList);

    final ListViewer availableLangViewer = new ListViewer(availableLangList);
    CollectionContentProvider collectionContentProvider = new CollectionContentProvider();
    availableLangViewer.setContentProvider(collectionContentProvider);
    availableLangViewer.setInput(availableLanguages);
    availableLangViewer.setSorter(new ViewerSorter(cLanguageCollator));

    final Composite buttonsComposite1 = new Composite(leftComposite, SWT.NONE);
    layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonsComposite1.setLayout(layout);
    data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    buttonsComposite1.setLayoutData(data);

    final Button allRightButton = new Button(buttonsComposite1, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    allRightButton.setLayoutData(data);
    allRightButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("all.right.icon"))); // $NON-NLS-1$
    allRightButton.setToolTipText(
        EclipseNSISPlugin.getResourceString("all.right.tooltip")); // $NON-NLS-1$

    final Button rightButton = new Button(buttonsComposite1, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    rightButton.setLayoutData(data);
    rightButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("right.icon"))); // $NON-NLS-1$
    rightButton.setToolTipText(EclipseNSISPlugin.getResourceString("right.tooltip")); // $NON-NLS-1$

    final Button leftButton = new Button(buttonsComposite1, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    leftButton.setLayoutData(data);
    leftButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("left.icon"))); // $NON-NLS-1$
    leftButton.setToolTipText(EclipseNSISPlugin.getResourceString("left.tooltip")); // $NON-NLS-1$

    final Button allLeftButton = new Button(buttonsComposite1, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    allLeftButton.setLayoutData(data);
    allLeftButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("all.left.icon"))); // $NON-NLS-1$
    allLeftButton.setToolTipText(
        EclipseNSISPlugin.getResourceString("all.left.tooltip")); // $NON-NLS-1$

    Composite rightComposite = new Composite(listsComposite, SWT.NONE);
    rightComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    rightComposite.setLayout(layout);

    ((GridData)
                NSISWizardDialogUtil.createLabel(
                        rightComposite,
                        "selected.languages.label", //$NON-NLS-1$
                        true,
                        m,
                        isScriptWizard())
                    .getLayoutData())
            .horizontalSpan =
        2;

    final List selectedLangList =
        new List(rightComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    Dialog.applyDialogFont(selectedLangList);
    data.heightHint = Common.calculateControlSize(selectedLangList, 0, 12).y;
    selectedLangList.setLayoutData(data);
    m.addSlave(selectedLangList);

    final ListViewer selectedLangViewer = new ListViewer(selectedLangList);
    selectedLangViewer.setContentProvider(collectionContentProvider);
    selectedLangViewer.setInput(selectedLanguages);

    final ListViewerUpDownMover<java.util.List<NSISLanguage>, NSISLanguage> mover =
        new ListViewerUpDownMover<java.util.List<NSISLanguage>, NSISLanguage>() {
          @Override
          @SuppressWarnings("unchecked")
          protected java.util.List<NSISLanguage> getAllElements() {
            return (java.util.List<NSISLanguage>) ((ListViewer) getViewer()).getInput();
          }

          @Override
          protected void updateStructuredViewerInput(
              java.util.List<NSISLanguage> input,
              java.util.List<NSISLanguage> elements,
              java.util.List<NSISLanguage> move,
              boolean isDown) {
            (input).clear();
            (input).addAll(elements);
          }
        };

    mover.setViewer(selectedLangViewer);

    final Composite buttonsComposite2 = new Composite(rightComposite, SWT.NONE);
    layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonsComposite2.setLayout(layout);
    data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    buttonsComposite2.setLayoutData(data);

    final Button upButton = new Button(buttonsComposite2, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    upButton.setLayoutData(data);
    upButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("up.icon"))); // $NON-NLS-1$
    upButton.setToolTipText(EclipseNSISPlugin.getResourceString("up.tooltip")); // $NON-NLS-1$
    m.addSlave(upButton);

    final Button downButton = new Button(buttonsComposite2, SWT.PUSH);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    downButton.setLayoutData(data);
    downButton.setImage(
        EclipseNSISPlugin.getImageManager()
            .getImage(EclipseNSISPlugin.getResourceString("down.icon"))); // $NON-NLS-1$
    downButton.setToolTipText(EclipseNSISPlugin.getResourceString("down.tooltip")); // $NON-NLS-1$
    m.addSlave(downButton);

    Composite langOptions = langGroup;
    boolean showSupportedLangOption =
        NSISPreferences.getInstance().getNSISVersion().compareTo(INSISVersions.VERSION_2_26) >= 0;
    if (showSupportedLangOption) {
      langOptions = new Composite(langGroup, SWT.None);
      layout = new GridLayout(2, false);
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      langOptions.setLayout(layout);
      data = new GridData(SWT.FILL, SWT.FILL, true, false);
      langOptions.setLayoutData(data);
    }

    final Button selectLang =
        NSISWizardDialogUtil.createCheckBox(
            langOptions,
            "select.language.label",
            settings.isSelectLanguage(),
            true,
            m,
            false); //$NON-NLS-1$

    final Button displaySupported;
    if (showSupportedLangOption) {
      ((GridData) selectLang.getLayoutData()).horizontalSpan = 1;
      displaySupported =
          NSISWizardDialogUtil.createCheckBox(
              langOptions,
              "display.supported.languages.label",
              settings.isDisplaySupportedLanguages(), // $NON-NLS-1$
              true,
              m,
              false);
      ((GridData) displaySupported.getLayoutData()).horizontalSpan = 1;
      displaySupported.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              mWizard.getSettings().setDisplaySupportedLanguages(displaySupported.getSelection());
            }
          });
    } else {
      displaySupported = null;
    }

    final MasterSlaveEnabler mse =
        new MasterSlaveEnabler() {
          public void enabled(Control control, boolean flag) {}

          @SuppressWarnings("unchecked")
          public boolean canEnable(Control control) {
            NSISWizardSettings settings = mWizard.getSettings();

            if (control == allRightButton) {
              return settings.isEnableLanguageSupport()
                  && availableLangViewer.getList().getItemCount() > 0;
            } else if (control == rightButton) {
              return settings.isEnableLanguageSupport()
                  && !availableLangViewer.getSelection().isEmpty();
            } else if (control == allLeftButton) {
              return settings.isEnableLanguageSupport()
                  && selectedLangViewer.getList().getItemCount() > 0;
            } else if (control == leftButton) {
              return settings.isEnableLanguageSupport()
                  && !selectedLangViewer.getSelection().isEmpty();
            } else if (control == upButton) {
              return settings.isEnableLanguageSupport() && mover.canMoveUp();
            } else if (control == downButton) {
              return settings.isEnableLanguageSupport() && mover.canMoveDown();
            } else if (control == selectLang) {
              java.util.List<NSISLanguage> selectedLanguages =
                  (java.util.List<NSISLanguage>) selectedLangViewer.getInput();
              return settings.getInstallerType() != INSTALLER_TYPE_SILENT
                  && settings.isEnableLanguageSupport()
                  && selectedLanguages.size() > 1;
            } else if (control == displaySupported && displaySupported != null) {
              java.util.List<NSISLanguage> selectedLanguages =
                  (java.util.List<NSISLanguage>) selectedLangViewer.getInput();
              return settings.getInstallerType() != INSTALLER_TYPE_SILENT
                  && settings.isEnableLanguageSupport()
                  && selectedLanguages.size() > 1
                  && selectLang.getSelection();
            } else {
              return true;
            }
          }
        };
    m.addSlave(rightButton, mse);
    m.addSlave(allRightButton, mse);
    m.addSlave(leftButton, mse);
    m.addSlave(allLeftButton, mse);
    m.setEnabler(upButton, mse);
    m.setEnabler(downButton, mse);
    m.setEnabler(selectLang, mse);
    if (displaySupported != null) {
      m.setEnabler(displaySupported, mse);
    }

    selectLang.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            mWizard.getSettings().setSelectLanguage(selectLang.getSelection());
            if (displaySupported != null) {
              displaySupported.setEnabled(mse.canEnable(displaySupported));
            }
          }
        });

    final Runnable langRunnable =
        new Runnable() {
          public void run() {
            availableLangViewer.refresh(false);
            selectedLangViewer.refresh(false);
            allRightButton.setEnabled(mse.canEnable(allRightButton));
            allLeftButton.setEnabled(mse.canEnable(allLeftButton));
            rightButton.setEnabled(mse.canEnable(rightButton));
            leftButton.setEnabled(mse.canEnable(leftButton));
            upButton.setEnabled(mse.canEnable(upButton));
            downButton.setEnabled(mse.canEnable(downButton));
            selectLang.setEnabled(mse.canEnable(selectLang));
            if (displaySupported != null) {
              displaySupported.setEnabled(mse.canEnable(displaySupported));
            }
            setPageComplete(validateField(LANG_CHECK));
          }
        };

    rightButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            moveAcross(
                availableLangViewer,
                selectedLangViewer,
                Common.makeGenericList(
                    NSISLanguage.class,
                    ((IStructuredSelection) availableLangViewer.getSelection()).toList()));
            langRunnable.run();
          }
        });
    allRightButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          @SuppressWarnings("unchecked")
          public void widgetSelected(SelectionEvent se) {
            moveAcross(
                availableLangViewer,
                selectedLangViewer,
                (java.util.List<NSISLanguage>) availableLangViewer.getInput());
            langRunnable.run();
          }
        });
    leftButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            moveAcross(
                selectedLangViewer,
                availableLangViewer,
                Common.makeGenericList(
                    NSISLanguage.class,
                    ((IStructuredSelection) selectedLangViewer.getSelection()).toList()));
            langRunnable.run();
          }
        });
    allLeftButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          @SuppressWarnings("unchecked")
          public void widgetSelected(SelectionEvent se) {
            moveAcross(
                selectedLangViewer,
                availableLangViewer,
                (java.util.List<NSISLanguage>) selectedLangViewer.getInput());
            langRunnable.run();
          }
        });
    upButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            mover.moveUp();
            langRunnable.run();
          }
        });
    downButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            mover.moveDown();
            langRunnable.run();
          }
        });

    availableLangViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            rightButton.setEnabled(mse.canEnable(rightButton));
            allRightButton.setEnabled(mse.canEnable(allRightButton));
          }
        });
    availableLangViewer
        .getList()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetDefaultSelected(SelectionEvent event) {
                IStructuredSelection sel =
                    (IStructuredSelection) availableLangViewer.getSelection();
                if (!sel.isEmpty()) {
                  moveAcross(
                      availableLangViewer,
                      selectedLangViewer,
                      Common.makeGenericList(NSISLanguage.class, sel.toList()));
                  selectedLangViewer.reveal(sel.getFirstElement());
                  langRunnable.run();
                }
              }
            });
    selectedLangViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            leftButton.setEnabled(mse.canEnable(leftButton));
            allLeftButton.setEnabled(mse.canEnable(allLeftButton));
            upButton.setEnabled(mse.canEnable(upButton));
            downButton.setEnabled(mse.canEnable(downButton));
            selectLang.setEnabled(mse.canEnable(selectLang));
            if (displaySupported != null) {
              displaySupported.setEnabled(mse.canEnable(displaySupported));
            }
          }
        });
    selectedLangViewer
        .getList()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetDefaultSelected(SelectionEvent event) {
                IStructuredSelection sel = (IStructuredSelection) selectedLangViewer.getSelection();
                if (!sel.isEmpty()) {
                  moveAcross(
                      selectedLangViewer,
                      availableLangViewer,
                      Common.makeGenericList(NSISLanguage.class, sel.toList()));
                  availableLangViewer.reveal(sel.getFirstElement());
                  langRunnable.run();
                }
              }
            });

    m.updateSlaves();

    listsComposite.addListener(
        SWT.Resize,
        new Listener() {
          boolean init = false;

          public void handleEvent(Event e) {
            if (!init) {
              // Stupid hack so that the height hint doesn't get changed
              // on the first resize,
              // i.e., when the page is drawn for the first time.
              init = true;
            } else {
              Point size = listsComposite.getSize();
              GridLayout layout = (GridLayout) listsComposite.getLayout();
              int heightHint = size.y - 2 * layout.marginHeight;
              ((GridData) availableLangList.getLayoutData()).heightHint = heightHint;
              ((GridData) selectedLangList.getLayoutData()).heightHint = heightHint;
              int totalWidth = size.x - 2 * layout.marginWidth - 3 * layout.horizontalSpacing;
              int listWidth = (int) (totalWidth * 0.4);
              int buttonWidth = (int) (0.5 * (totalWidth - 2 * listWidth));
              size = availableLangList.computeSize(listWidth, SWT.DEFAULT);
              int delta = 0;
              if (size.x > listWidth) {
                delta = size.x - listWidth;
                listWidth = listWidth - delta;
              }
              ((GridData) availableLangList.getLayoutData()).widthHint = listWidth;
              ((GridData) buttonsComposite1.getLayoutData()).widthHint =
                  totalWidth - 2 * (listWidth + delta) - buttonWidth;
              ((GridData) selectedLangList.getLayoutData()).widthHint = listWidth;
              ((GridData) buttonsComposite2.getLayoutData()).widthHint = buttonWidth;
              listsComposite.layout();
            }
          }
        });

    addPageChangedRunnable(
        new Runnable() {
          public void run() {
            if (isCurrentPage()) {
              selectLang.setEnabled(mse.canEnable(selectLang));
              if (displaySupported != null) {
                displaySupported.setEnabled(mse.canEnable(displaySupported));
              }
            }
          }
        });

    mWizard.addSettingsListener(
        new INSISWizardSettingsListener() {
          public void settingsChanged(
              NSISWizardSettings oldSettings, NSISWizardSettings newSettings) {
            enableLangSupport.setSelection(newSettings.isEnableLanguageSupport());
            m.updateSlaves();
            selectLang.setSelection(newSettings.isSelectLanguage());
            if (displaySupported != null) {
              displaySupported.setSelection(newSettings.isDisplaySupportedLanguages());
            }
            java.util.List<NSISLanguage> selectedLanguages = newSettings.getLanguages();
            java.util.List<NSISLanguage> availableLanguages =
                NSISLanguageManager.getInstance().getLanguages();
            if (selectedLanguages.isEmpty()) {
              NSISWizardWelcomePage welcomePage =
                  (NSISWizardWelcomePage) mWizard.getPage(NSISWizardWelcomePage.NAME);
              if (welcomePage != null) {
                if (!welcomePage.isCreateFromTemplate()) {
                  NSISLanguage defaultLanguage =
                      NSISLanguageManager.getInstance().getDefaultLanguage();
                  if (defaultLanguage != null && availableLanguages.contains(defaultLanguage)) {
                    selectedLanguages.add(defaultLanguage);
                  }
                }
              }
            }
            selectedLangViewer.setInput(selectedLanguages);
            availableLanguages.removeAll(selectedLanguages);
            availableLangViewer.setInput(availableLanguages);
          }
        });
  }
  public ArrayList open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(Messages.getString("EnterMappingDialog.Title"));

    int margin = Const.MARGIN;
    int buttonSpace = 90;

    // Source table
    wlSource = new Label(shell, SWT.NONE);
    wlSource.setText(Messages.getString("EnterMappingDialog.SourceFields.Label"));
    props.setLook(wlSource);
    fdlSource = new FormData();
    fdlSource.left = new FormAttachment(0, 0);
    fdlSource.top = new FormAttachment(0, margin);
    wlSource.setLayoutData(fdlSource);
    wSource = new List(shell, SWT.SINGLE | SWT.RIGHT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    for (int i = 0; i < sourceList.length; i++) wSource.add(sourceList[i]);
    props.setLook(wSource);
    fdSource = new FormData();
    fdSource.left = new FormAttachment(0, 0);
    fdSource.right = new FormAttachment(25, 0);
    fdSource.top = new FormAttachment(wlSource, margin);
    fdSource.bottom = new FormAttachment(100, -buttonSpace);
    wSource.setLayoutData(fdSource);

    // Automatic target selection
    wlSourceAuto = new Label(shell, SWT.NONE);
    wlSourceAuto.setText(Messages.getString("EnterMappingDialog.AutoTargetSelection.Label"));
    props.setLook(wlSourceAuto);
    fdlSourceAuto = new FormData();
    fdlSourceAuto.left = new FormAttachment(0, 0);
    fdlSourceAuto.top = new FormAttachment(wSource, margin);
    wlSourceAuto.setLayoutData(fdlSourceAuto);
    wSourceAuto = new Button(shell, SWT.CHECK);
    wSourceAuto.setSelection(true);
    props.setLook(wSourceAuto);
    fdSourceAuto = new FormData();
    fdSourceAuto.left = new FormAttachment(wlSourceAuto, margin * 2);
    fdSourceAuto.right = new FormAttachment(25, 0);
    fdSourceAuto.top = new FormAttachment(wSource, margin);
    wSourceAuto.setLayoutData(fdSourceAuto);

    // Hide used source fields?
    wlSourceHide = new Label(shell, SWT.NONE);
    wlSourceHide.setText(Messages.getString("EnterMappingDialog.HideUsedSources"));
    props.setLook(wlSourceHide);
    fdlSourceHide = new FormData();
    fdlSourceHide.left = new FormAttachment(0, 0);
    fdlSourceHide.top = new FormAttachment(wSourceAuto, margin);
    wlSourceHide.setLayoutData(fdlSourceHide);
    wSourceHide = new Button(shell, SWT.CHECK);
    wSourceHide.setSelection(true);
    props.setLook(wSourceHide);
    fdSourceHide = new FormData();
    fdSourceHide.left = new FormAttachment(wlSourceHide, margin * 2);
    fdSourceHide.right = new FormAttachment(25, 0);
    fdSourceHide.top = new FormAttachment(wSourceAuto, margin);
    wSourceHide.setLayoutData(fdSourceHide);
    wSourceHide.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            refreshMappings();
          }
        });

    // Target table
    wlTarget = new Label(shell, SWT.NONE);
    wlTarget.setText(Messages.getString("EnterMappingDialog.TargetFields.Label"));
    props.setLook(wlTarget);
    fdlTarget = new FormData();
    fdlTarget.left = new FormAttachment(wSource, margin * 2);
    fdlTarget.top = new FormAttachment(0, margin);
    wlTarget.setLayoutData(fdlTarget);
    wTarget = new List(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    for (int i = 0; i < targetList.length; i++) wTarget.add(targetList[i]);
    props.setLook(wTarget);
    fdTarget = new FormData();
    fdTarget.left = new FormAttachment(wSource, margin * 2);
    fdTarget.right = new FormAttachment(50, 0);
    fdTarget.top = new FormAttachment(wlTarget, margin);
    fdTarget.bottom = new FormAttachment(100, -buttonSpace);
    wTarget.setLayoutData(fdTarget);

    // Automatic target selection
    wlTargetAuto = new Label(shell, SWT.NONE);
    wlTargetAuto.setText(Messages.getString("EnterMappingDialog.AutoSourceSelection.Label"));
    props.setLook(wlTargetAuto);
    fdlTargetAuto = new FormData();
    fdlTargetAuto.left = new FormAttachment(wSource, margin * 2);
    fdlTargetAuto.top = new FormAttachment(wTarget, margin);
    wlTargetAuto.setLayoutData(fdlTargetAuto);
    wTargetAuto = new Button(shell, SWT.CHECK);
    wTargetAuto.setSelection(false);
    props.setLook(wTargetAuto);
    fdTargetAuto = new FormData();
    fdTargetAuto.left = new FormAttachment(wlTargetAuto, margin * 2);
    fdTargetAuto.right = new FormAttachment(50, 0);
    fdTargetAuto.top = new FormAttachment(wTarget, margin);
    wTargetAuto.setLayoutData(fdTargetAuto);

    // Automatic target selection
    wlTargetHide = new Label(shell, SWT.NONE);
    wlTargetHide.setText(Messages.getString("EnterMappingDialog.HideUsedTargets"));
    props.setLook(wlTargetHide);
    fdlTargetHide = new FormData();
    fdlTargetHide.left = new FormAttachment(wSource, margin * 2);
    fdlTargetHide.top = new FormAttachment(wTargetAuto, margin);
    wlTargetHide.setLayoutData(fdlTargetHide);
    wTargetHide = new Button(shell, SWT.CHECK);
    wTargetHide.setSelection(true);
    props.setLook(wTargetHide);
    fdTargetHide = new FormData();
    fdTargetHide.left = new FormAttachment(wlTargetHide, margin * 2);
    fdTargetHide.right = new FormAttachment(50, 0);
    fdTargetHide.top = new FormAttachment(wTargetAuto, margin);
    wTargetHide.setLayoutData(fdTargetHide);

    wTargetHide.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            refreshMappings();
          }
        });

    // Add a couple of buttons:
    wAdd = new Button(shell, SWT.PUSH);
    fdAdd = new FormData();
    wAdd.setText(Messages.getString("EnterMappingDialog.Button.Add"));
    fdAdd.left = new FormAttachment(wTarget, margin * 2);
    fdAdd.top = new FormAttachment(wTarget, 0, SWT.CENTER);
    wAdd.setLayoutData(fdAdd);
    Listener lsAdd =
        new Listener() {
          public void handleEvent(Event e) {
            add();
          }
        };
    wAdd.addListener(SWT.Selection, lsAdd);

    // Delete a couple of buttons:
    wDelete = new Button(shell, SWT.PUSH);
    fdDelete = new FormData();
    wDelete.setText(Messages.getString("EnterMappingDialog.Button.Delete"));
    fdDelete.left = new FormAttachment(wTarget, margin * 2);
    fdDelete.top = new FormAttachment(wAdd, margin * 2);
    wDelete.setLayoutData(fdDelete);
    Listener lsDelete =
        new Listener() {
          public void handleEvent(Event e) {
            delete();
          }
        };
    wDelete.addListener(SWT.Selection, lsDelete);

    // Result table
    wlResult = new Label(shell, SWT.NONE);
    wlResult.setText(Messages.getString("EnterMappingDialog.ResultMappings.Label"));
    props.setLook(wlResult);
    fdlResult = new FormData();
    fdlResult.left = new FormAttachment(wDelete, margin * 2);
    fdlResult.top = new FormAttachment(0, margin);
    wlResult.setLayoutData(fdlResult);
    wResult = new List(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    for (int i = 0; i < targetList.length; i++) wResult.add(targetList[i]);
    props.setLook(wResult);
    fdResult = new FormData();
    fdResult.left = new FormAttachment(wDelete, margin * 2);
    fdResult.right = new FormAttachment(100, 0);
    fdResult.top = new FormAttachment(wlResult, margin);
    fdResult.bottom = new FormAttachment(100, -30);
    wResult.setLayoutData(fdResult);

    // Some buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(Messages.getString("System.Button.OK"));
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };
    wOK.addListener(SWT.Selection, lsOK);

    // Some buttons
    wGuess = new Button(shell, SWT.PUSH);
    wGuess.setText(Messages.getString("EnterMappingDialog.Button.Guess"));
    lsGuess =
        new Listener() {
          public void handleEvent(Event e) {
            guess();
          }
        };
    wGuess.addListener(SWT.Selection, lsGuess);

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(Messages.getString("System.Button.Cancel"));
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    wCancel.addListener(SWT.Selection, lsCancel);

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wGuess, wCancel}, margin, null);

    wSource.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (wSourceAuto.getSelection()) findTarget();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            add();
          }
        });

    wTarget.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (wTargetAuto.getSelection()) findSource();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            add();
          }
        });

    // Detect [X] or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return mappings;
  }