public void actionPerformed(ActionEvent e) {
		// Construct the regular grammar.
		RightLinearGrammar grammar = (RightLinearGrammar) environment
				.getGrammar(RightLinearGrammar.class);
		if (grammar == null)
			return;
		if (grammar.getProductions().length == 0) {
			JOptionPane.showMessageDialog(Universe
					.frameForEnvironment(environment),
					"The grammar should exist.");
			return;
		}

		// Create the initial automaton.
		FiniteStateAutomaton fsa = new FiniteStateAutomaton();
		RightLinearGrammarToFSAConverter convert = new RightLinearGrammarToFSAConverter();
		convert.createStatesForConversion(grammar, fsa);
		AutomatonGraph graph = new AutomatonGraph(fsa);
		// Create the map of productions to transitions.
		HashMap ptot = new HashMap();
		Production[] prods = grammar.getProductions();
		for (int i = 0; i < prods.length; i++) {
			Transition t = convert.getTransitionForProduction(prods[i]);
			graph.addEdge(t.getFromState(), t.getToState());
			ptot.put(prods[i], t);
		}
		// Add the view to the environment.
		final ConvertPane cp = new ConvertPane(grammar, fsa, ptot, environment);
		environment.add(cp, "Convert to FA", new CriticalTag() {
		});
		Rectangle r = cp.getEditorPane().getAutomatonPane().getVisibleRect();
		LayoutAlgorithm layout = new GEMLayoutAlgorithm();
		layout.layout(graph, null);
		graph.moveAutomatonStates();
		environment.setActive(cp);
		environment.validate();
		cp.getEditorPane().getAutomatonPane().fitToBounds(20);
	}