/**
  * Create widgets to enable user to input data for fields of text or number type
  *
  * @param parent composite where the widgets will be attached to
  * @param monkeyOption the corresponding monkey option
  */
 private void createWidgetsForTextOrNumberType(
     final Composite parent, final MonkeyOption monkeyOption) {
   // create input text
   if ((monkeyOption.getPreDefinedValues() == null)
       || (monkeyOption.getPreDefinedValues().size() == 0)) {
     final Text inputText = new Text(parent, SWT.SINGLE | SWT.BORDER);
     inputText.setText(monkeyOption.getValue());
     monkeyOption.setValueWidget(inputText);
     inputText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
     inputText.addModifyListener(
         new ModifyListener() {
           @Override
           public void modifyText(ModifyEvent e) {
             monkeyOption.setValue(inputText.getText());
             notifyCompositeChangeListeners();
           }
         });
   }
   // create combobox
   else {
     final Combo combo = new Combo(parent, SWT.READ_ONLY);
     monkeyOption.setValueWidget(combo);
     int selectedIndex = 0;
     for (String preDefinedValue : monkeyOption.getPreDefinedValues()) {
       combo.add(preDefinedValue);
       if (monkeyOption.getValue().equals(preDefinedValue)) {
         combo.select(selectedIndex);
       } else {
         selectedIndex++;
       }
     }
     combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
     combo.addModifyListener(
         new ModifyListener() {
           @Override
           public void modifyText(ModifyEvent e) {
             monkeyOption.setValue(combo.getText());
             notifyCompositeChangeListeners();
           }
         });
   }
 }
  /**
   * Create widgets to enable user to input data for fields of path type
   *
   * @param parent composite where the widgets will be attached to
   * @param monkeyOption the corresponding monkey option
   */
  private void createWidgetsForPathType(final Composite parent, final MonkeyOption monkeyOption) {
    // create input text
    final Text pathText = new Text(parent, SWT.SINGLE | SWT.BORDER);
    pathText.setText(monkeyOption.getValue());
    monkeyOption.setValueWidget(pathText);
    pathText.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
    pathText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            monkeyOption.setValue(pathText.getText());
            notifyCompositeChangeListeners();
          }
        });
    // create browse button
    Button pathBrowseButton = new Button(parent, SWT.PUSH);
    pathBrowseButton.setText(AndroidNLS.UI_General_BrowseButtonLabel);
    GridData data = new GridData(SWT.NULL, SWT.NULL, false, false);
    pathBrowseButton.setLayoutData(data);
    pathBrowseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            String selectedPath = null;

            if (monkeyOption.getTypeDetails().equals(TYPE_PATH_DIR)) {
              DirectoryDialog directoryDialog = new DirectoryDialog(getShell(), SWT.OPEN);
              selectedPath = directoryDialog.open();
            } else {
              FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
              String[] filterExtensions = {"*" + monkeyOption.getTypeDetails()};
              fileDialog.setFilterExtensions(filterExtensions);
              selectedPath = fileDialog.open();
            }

            if (selectedPath != null) {
              pathText.setText(selectedPath);
            }
          }
        });
  }