Warning: Can't use blame annotator:
svn blame failed on trunk/src/tmcsim/simulationmanager/actions/StartSimulationAction.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/trunk/src/tmcsim/simulationmanager/actions/StartSimulationAction.java @ 123

Revision 123, 2.2 KB checked in by jdalbey, 9 years ago (diff)

Multiple renaming of classes to improve clarity. Remove check for Paramics running before starting sim.

RevLine 
1package tmcsim.simulationmanager.actions;
2
3import java.awt.event.ActionEvent;
4
5import javax.swing.AbstractAction;
6import javax.swing.JOptionPane;
7
8import tmcsim.common.ScriptException;
9import tmcsim.common.SimulationException;
10import tmcsim.simulationmanager.SimulationManagerView;
11
12/**
13 * StartSimulationAction is an AbstractAction that is used for starting
14 * the simulation. When the action is performed,
15 * the action calls the SimulationManagerModel to start the
16 * simulation.
17 * @author Matthew Cechini
18 */
19@SuppressWarnings("serial")
20public class StartSimulationAction extends AbstractAction {
21   
22    /** Reference to the SimulationManagerView object. */
23    private SimulationManagerView theSimManagerView = null;
24   
25    /**
26     * Constructor.
27     * @param View class object for the Simulation Manager.
28     */
29    public StartSimulationAction(SimulationManagerView view) {
30        super("Start");
31       
32        theSimManagerView = view;
33    }
34   
35    public void actionPerformed(ActionEvent evt) {
36        Runnable startRunnable = new Runnable(){       
37            public void run() 
38            {
39                // Remove this check because Paramics is no longer used as of 2017
40//                if(!theSimManagerView.isConnectedToParamics()) {
41//                    if (JOptionPane.showConfirmDialog(null, "Connection has not been " +
42//                            "made to the Paramics Traffic Modeler.  Do you wish " +
43//                            "to continue?", "Paramics Connection",
44//                            JOptionPane.YES_NO_OPTION,
45//                            JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
46//                                return;
47//                            }
48//                }
49               
50                try { 
51                    theSimManagerView.getModel().startSimulation();
52                }
53                catch (ScriptException se) {
54                    theSimManagerView.ScriptExceptionHandler(se);
55                }
56                catch (SimulationException se) {
57                    theSimManagerView.SimulationExceptionHandler(se);
58                }
59            }       
60        };     
61
62        Thread theThread = new Thread(startRunnable);
63        theThread.start();
64    }
65
66}
Note: See TracBrowser for help on using the repository browser.