@Override
 public void doAction() {
   if (getAutomationItem() != null) {
     boolean isChanged = true;
     if (!Setup.isGenerateCsvSwitchListEnabled()) {
       log.warn("Generate CSV Switch List isn't enabled!");
       finishAction(false);
       return;
     }
     // we do need one of these!
     if (!TrainCustomSwitchList.manifestCreatorFileExists()) {
       log.warn(
           "Manifest creator file not found!, directory name: {}, file name: {}",
           TrainCustomSwitchList.getDirectoryName(),
           TrainCustomSwitchList.getFileName());
       finishAction(false);
       return;
     }
     setRunning(true);
     TrainSwitchLists trainSwitchLists = new TrainSwitchLists();
     TrainCsvSwitchLists trainCsvSwitchLists = new TrainCsvSwitchLists();
     for (Location location : LocationManager.instance().getLocationsByNameList()) {
       if (location.isSwitchListEnabled()
           && (!isChanged || isChanged && location.getStatus().equals(Location.MODIFIED))) {
         // also build the regular switch lists so they can be used
         if (!Setup.isSwitchListRealTime()) {
           trainSwitchLists.buildSwitchList(location);
         }
         File csvFile = trainCsvSwitchLists.buildSwitchList(location);
         if (csvFile == null || !csvFile.exists()) {
           log.error("CSV switch list file was not created for location {}", location.getName());
           finishAction(false);
           return;
         }
         TrainCustomSwitchList.addCVSFile(csvFile);
       }
     }
     // Processes the CSV Manifest files using an external custom program.
     int fileCount = TrainCustomSwitchList.getFileCount();
     boolean status = TrainCustomSwitchList.process();
     if (status) {
       try {
         TrainCustomSwitchList.waitForProcessToComplete(
             Control.excelWaitTime * fileCount); // wait up to 60 seconds per file
       } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
     // set trains switch lists printed
     TrainManager.instance().setTrainsSwitchListStatus(Train.PRINTED);
     finishAction(status);
   }
 }
 private void updateSwitchListButton() {
   log.debug("update switch list button");
   List<Location> locations = locationManager.getList();
   for (Location location : locations) {
     if (location != null
         && location.isSwitchListEnabled()
         && location.getStatus().equals(Location.MODIFIED)) {
       switchListsButton.setBackground(Color.RED);
       return;
     }
   }
   switchListsButton.setBackground(Color.GREEN);
 }
 public void buildSwitchLists() {
   TrainSwitchLists trainSwitchLists = new TrainSwitchLists();
   String locationName = ""; // only create switch lists once for locations with similar names
   for (Location location : LocationManager.instance().getLocationsByNameList()) {
     if (location.isSwitchListEnabled()
         && !locationName.equals(TrainCommon.splitString(location.getName()))) {
       trainSwitchLists.buildSwitchList(location);
       // print switch lists for locations that have changes
       if (Setup.isSwitchListRealTime() && location.getStatus().equals(Location.MODIFIED)) {
         trainSwitchLists.printSwitchList(
             location, TrainManager.instance().isPrintPreviewEnabled());
         locationName = TrainCommon.splitString(location.getName());
       }
     }
   }
   // set trains switch lists printed
   TrainManager.instance().setTrainsSwitchListStatus(Train.PRINTED);
 }