public Composite createPreferenceComposite(
      Composite parent, final IBuildParticipantWorkingCopy participant) {
    Composite master = new Composite(parent, SWT.NONE);
    master.setLayout(GridLayoutFactory.fillDefaults().create());

    GridDataFactory fillHoriz = GridDataFactory.fillDefaults().grab(true, false);

    // JSON Options
    Group group = new Group(master, SWT.BORDER);
    group.setText(Messages.JSLintValidatorPreferenceCompositeFactory_OptionsTitle);
    group.setLayout(new GridLayout());
    group.setLayoutData(fillHoriz.create());

    Label label = new Label(group, SWT.WRAP);
    label.setText(Messages.JSLintValidatorPreferenceCompositeFactory_OptionsMsg);
    fillHoriz.applyTo(label);

    final Text text = new Text(group, SWT.MULTI | SWT.V_SCROLL);

    final ControlDecoration decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
    decoration.setDescriptionText(
        Messages.JSLintValidatorPreferenceCompositeFactory_OptionsParseError);
    decoration.setImage(
        PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR));
    decoration.hide();

    text.setText(participant.getPreferenceString(IPreferenceConstants.JS_LINT_OPTIONS));
    fillHoriz.hint(SWT.DEFAULT, 100).applyTo(text);
    text.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            decoration.hide();
            try {
              String optionsAsJSON = text.getText();
              JSON.parse(optionsAsJSON);
              participant.setPreference(IPreferenceConstants.JS_LINT_OPTIONS, text.getText());
            } catch (IllegalStateException e1) {
              decoration.show();
            }
          }
        });

    // Filters
    Composite filtersGroup = new ValidatorFiltersPreferenceComposite(master, participant);
    filtersGroup.setLayoutData(fillHoriz.grab(true, true).hint(SWT.DEFAULT, 150).create());

    return master;
  }
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);

    GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
    container.setLayoutData(gridData);
    container.setLayout(new GridLayout(1, false));

    Group nameGroup = new Group(container, SWT.NONE);
    nameGroup.setText("Name and location");
    GridDataFactory.fillDefaults().grab(true, false).applyTo(nameGroup);
    GridLayoutFactory.fillDefaults().numColumns(3).margins(8, 8).applyTo(nameGroup);

    Label nameLabel = new Label(nameGroup, SWT.NONE);
    nameLabel.setText(ProjectMessages.NewApplicationWizardPage_project_name_label);

    projectNameField = new Text(nameGroup, SWT.BORDER);
    projectNameField.setText(""); // $NON-NLS-1$
    projectNameField.setToolTipText(ProjectMessages.NewApplicationWizardPage_project_name_tooltip);
    projectNameField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    projectNameField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            projectNameField.selectAll();
          }
        });
    projectNameField.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            updateName();
          }
        });

    Label locationLabel = new Label(nameGroup, SWT.NONE);
    locationLabel.setText(ProjectMessages.NewApplicationWizardPage_directory_label);

    projectLocationField = new Text(nameGroup, SWT.BORDER);
    projectLocationField.setText(defaultLocation);
    projectLocationField.setToolTipText(ProjectMessages.NewApplicationWizardPage_directory_tooltip);
    projectLocationField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    projectLocationField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            projectLocationField.selectAll();
          }
        });
    projectLocationField.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            updateLocation();
          }
        });

    Button browseButton = new Button(nameGroup, SWT.NONE);
    browseButton.setText(ProjectMessages.NewApplicationWizardPage_browse_label);
    browseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleBrowseButton(projectLocationField);
          }
        });
    PixelConverter converter = new PixelConverter(browseButton);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    GridDataFactory.swtDefaults().hint(widthHint, -1).applyTo(browseButton);

    projectNameField.setFocus();

    Group contentGroup = new Group(container, SWT.NONE);
    contentGroup.setText("Sample content");
    GridDataFactory.fillDefaults().span(3, 1).grab(true, false).indent(0, 10).applyTo(contentGroup);
    GridLayoutFactory.fillDefaults().margins(8, 8).applyTo(contentGroup);

    generateContentButton = new Button(contentGroup, SWT.CHECK);
    generateContentButton.setText("Generate sample content");
    generateContentButton.setSelection(getGenerateContentPreference());
    generateContentButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IDialogSettings settings =
                DartToolsPlugin.getDefault().getDialogSettingsSection(NEW_APPPLICATION_SETTINGS);
            settings.put(CONTENT_GENERATION_DISABLED, !generateContentButton.getSelection());

            updateMessageAndEnablement();
          }
        });

    Label spacer = new Label(contentGroup, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(spacer);

    samplesViewer =
        new TableViewer(contentGroup, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    samplesViewer.setLabelProvider(new LabelProvider());
    samplesViewer.setContentProvider(new ArrayContentProvider());
    List<AbstractSample> samples = AbstractSample.getAllSamples();
    samplesViewer.setInput(samples);
    {
      Control samplesControl = samplesViewer.getControl();
      int height = new PixelConverter(samplesControl).convertHeightInCharsToPixels(8);
      GridDataFactory gdf = GridDataFactory.fillDefaults();
      gdf.hint(-1, height);
      gdf.grab(true, false);
      gdf.align(SWT.FILL, SWT.CENTER);
      gdf.applyTo(samplesControl);
    }
    samplesViewer.setSelection(new StructuredSelection(getDefaultSample(samples)));
    samplesViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            updateMessageAndEnablement();
          }
        });

    updateMessageAndEnablement();

    setPageComplete(false);
  }