package beaform.gui.search;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JTextField;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import beaform.Search;

public class SearchAction implements ActionListener {

	private static final Logger LOG = LoggerFactory.getLogger(SearchAction.class);

	private final JTextField txtSearchTag;
	private final JComboBox<String> cmbType;

	public SearchAction(JTextField txtSearchTag, JComboBox<String> cmbType) {
		this.txtSearchTag = txtSearchTag;
		this.cmbType = cmbType;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		LOG.info("Search: " + this.txtSearchTag.getText() + " of type " + this.cmbType.getSelectedItem());
		Search search = new Search(this.cmbType.getSelectedItem().toString());
		try {
			search.search().wait();
		} catch (InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}

}

@@ -94,16 +94,91 @@
 istener;
+%0Aimport java.util.Iterator;%0Aimport java.util.concurrent.ExecutionException;
 %0A%0Aimport
@@ -313,16 +313,49 @@
 .Search;
+%0Aimport beaform.entities.Formula;
 %0A%0Apublic
@@ -954,54 +954,305 @@
 %0A%09%09%09
-search.search().wait();%0A%09%09%7D catch (Interrupted
+Iterator%3CFormula%3E formulas = search.search().get();%0A%09%09%09while (formulas.hasNext()) %7B%0A%09%09%09%09Formula formula = formulas.next();%0A%0A%09%09%09%09System.out.println(formula.toString());%0A%0A%09%09%09%7D%0A%09%09%7D catch (InterruptedException e1) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09e1.printStackTrace();%0A%09%09%7D%0A%09%09catch (Execution
 Exce

Fix the search