@Override
  public void actionPerformed(ActionEvent event) {
    final AnalysisJobBuilder ajb = new AnalysisJobBuilder(_configuration);
    ajb.setDatastore(_datastore);
    ajb.addSourceColumns(getColumns());

    final QuickAnalysisStrategy quickAnalysisStrategy = _userPreferences.getQuickAnalysisStrategy();

    quickAnalysisStrategy.configureAnalysisJobBuilder(ajb);

    try {
      if (!ajb.isConfigured(true)) {
        throw new IllegalStateException("Unknown job configuration issue!");
      }

      Injector injector = Guice.createInjector(new DCModule(_parentModule, ajb));

      RunAnalysisActionListener actionListener =
          injector.getInstance(RunAnalysisActionListener.class);
      actionListener.actionPerformed(event);
    } catch (Exception e) {
      WidgetUtils.showErrorMessage(
          "Error", "Could not perform quick analysis on table " + _table.getName(), e);
    }
  }
  @Inject
  public SingleResourcePropertyWidget(
      ConfiguredPropertyDescriptor propertyDescriptor,
      AbstractBeanJobBuilder<?, ?, ?> beanJobBuilder,
      UserPreferences userPreferences) {
    super(beanJobBuilder, propertyDescriptor);
    _userPreferences = userPreferences;

    boolean openFileDialog = true;
    String[] extensions = null;

    FileProperty fileProperty = propertyDescriptor.getAnnotation(FileProperty.class);
    if (fileProperty != null) {
      openFileDialog = fileProperty.accessMode() == FileAccessMode.OPEN;

      extensions = fileProperty.extension();
    }

    _resourceTypeComboBox =
        new DCComboBox<String>(new String[] {"file", "url", "classpath", "vfs"});
    _filenameField =
        new FilenameTextField(_userPreferences.getConfiguredFileDirectory(), openFileDialog);
    _otherPathTextField = WidgetFactory.createTextField();

    if (extensions != null && extensions.length > 0) {
      List<FileFilter> filters = new ArrayList<FileFilter>(extensions.length);
      for (String extension : extensions) {
        String extensionWithDot;
        if (extension.startsWith(".")) {
          extensionWithDot = extension;
        } else {
          extensionWithDot = "." + extension;
        }
        FileFilter filter =
            new ExtensionFilter(extension.toUpperCase() + " file", extensionWithDot);
        filters.add(filter);
        _filenameField.addChoosableFileFilter(filter);
      }
      if (filters.size() == 1) {
        _filenameField.setSelectedFileFilter(filters.get(0));
      } else {
        FileFilter filter =
            FileFilters.combined(
                "All suggested file formats", filters.toArray(new FileFilter[filters.size()]));
        _filenameField.setSelectedFileFilter(filter);
      }
    } else {
      _filenameField.setSelectedFileFilter(FileFilters.ALL);
    }

    final Resource currentValue = getCurrentValue();
    if (currentValue == null) {
      _otherPathTextField.setVisible(false);
      _immutableValue = null;
    } else if (currentValue instanceof FileResource) {
      _otherPathTextField.setVisible(false);
      _filenameField.setFile(((FileResource) currentValue).getFile());
      _immutableValue = null;
    } else if (currentValue instanceof UrlResource
        || currentValue instanceof VfsResource
        || currentValue instanceof ClasspathResource) {
      _filenameField.setVisible(false);
      _immutableValue = null;
    } else {
      _filenameField.setVisible(false);
      _immutableValue = currentValue;
    }

    if (_immutableValue == null) {
      _filenameField
          .getTextField()
          .getDocument()
          .addDocumentListener(
              new DCDocumentListener() {
                @Override
                protected void onChange(DocumentEvent e) {
                  fireValueChanged();
                }
              });

      _filenameField.addFileSelectionListener(
          new FileSelectionListener() {
            @Override
            public void onSelected(FilenameTextField filenameTextField, File file) {
              File dir = file.getParentFile();
              _userPreferences.setConfiguredFileDirectory(dir);
              fireValueChanged();
            }
          });

      _otherPathTextField
          .getDocument()
          .addDocumentListener(
              new DCDocumentListener() {
                @Override
                protected void onChange(DocumentEvent event) {
                  fireValueChanged();
                }
              });
      _resourceTypeComboBox.addListener(
          new Listener<String>() {
            @Override
            public void onItemSelected(String item) {
              boolean isFileMode = "file".equals(item);
              _filenameField.setVisible(isFileMode);
              _otherPathTextField.setVisible(!isFileMode);

              fireValueChanged();
            }
          });

      final DCPanel panel =
          DCPanel.flow(
              Alignment.LEFT, 0, 0, _resourceTypeComboBox, _filenameField, _otherPathTextField);
      add(panel);
    } else {
      add(DCLabel.dark("- Resource: " + _immutableValue.getName() + " -"));
    }
  }