public void actionPerformed(ActionEvent e) {
		Grammar grammar = environment.getGrammar();
		if (grammar == null)
			return;
		if (grammar.getProductions().length == 0) {
			JOptionPane.showMessageDialog(Universe
					.frameForEnvironment(environment),
					"The grammar should exist.");
			return;
		}
		// Create the initial automaton.
		PushdownAutomaton pda = new PushdownAutomaton();
		CFGToPDALRConverter convert = new CFGToPDALRConverter();
		convert.createStatesForConversion(grammar, pda);
		// Create the map of productions to transitions.
		HashMap ptot = new HashMap();
		Production[] prods = grammar.getProductions();
		for (int i = 0; i < prods.length; i++)
			ptot.put(prods[i], convert.getTransitionForProduction(prods[i]));
		// Add the view to the environment.
		final ConvertPane cp = new ConvertPane(grammar, pda, ptot, environment);
		environment.add(cp, "Convert to PDA (LR)", new CriticalTag() {
		});

		// Do the layout of the states.
		AutomatonGraph graph = new AutomatonGraph(pda);
		LayoutAlgorithm layout = new GEMLayoutAlgorithm();
		layout.layout(graph, null);
		graph.moveAutomatonStates();
		environment.setActive(cp);
		environment.validate();
		cp.getEditorPane().getAutomatonPane().fitToBounds(20);
	}