package beaform.gui.search;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import beaform.entities.Formula;
import beaform.gui.FormulaTree;

public final class RenderSearchResult implements Runnable { // NOPMD by steven on 5/16/16 4:31 PM

	private static final int FORMULA_TREE_LOC = 3;
	private final transient Future<Formula> searchresult;
	private final transient JPanel pane;

	public RenderSearchResult(final Future<Formula> searchresult, final JPanel pane) {
		this.searchresult = searchresult;
		this.pane = pane;
	}

	@Override
	public void run() {
		Formula searchResult;
		try {
			searchResult = this.searchresult.get();
		}
		catch (InterruptedException | ExecutionException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			return;
		}
		SwingUtilities.invokeLater(new AddFormTreeToGui(searchResult, this.pane));
	}

	public static final class AddFormTreeToGui implements Runnable { // NOPMD by steven on 5/16/16 4:30 PM
		private final Formula searchResult;
		private final JPanel pane;

		public AddFormTreeToGui(final Formula searchResult, final JPanel pane) {
			this.searchResult = searchResult;
			this.pane = pane;
		}

		@Override
		public void run() {
			final FormulaTree ft = new FormulaTree(this.searchResult);
			if (this.pane.getComponentCount() > FORMULA_TREE_LOC) {
				this.pane.remove(FORMULA_TREE_LOC);
			}
			this.pane.add(ft);
			this.pane.revalidate();
		}
	}
}
@@ -1314,17 +1314,26 @@
 laTree f
-t
+ormulaTree
  = new F
@@ -1485,17 +1485,26 @@
 ne.add(f
-t
+ormulaTree
 );%0A%09%09%09th

Rename variable for clarity