001package jmri.jmrit.operations; 002 003import java.util.Locale; 004 005import org.openide.util.lookup.ServiceProvider; 006 007import jmri.jmrit.operations.automation.AutomationsTableFrameAction; 008import jmri.jmrit.operations.locations.LocationsTableAction; 009import jmri.jmrit.operations.rollingstock.cars.CarsTableAction; 010import jmri.jmrit.operations.rollingstock.engines.EnginesTableAction; 011import jmri.jmrit.operations.routes.RoutesTableAction; 012import jmri.jmrit.operations.setup.OperationsSettingsAction; 013import jmri.jmrit.operations.trains.TrainsTableAction; 014import jmri.jmrit.operations.trains.schedules.TrainsScheduleAction; 015import jmri.util.startup.AbstractStartupActionFactory; 016import jmri.util.startup.StartupActionFactory; 017 018/** 019 * Factory for Operations-related startup actions. 020 * 021 * @author Randall Wood Copyright 2020 022 */ 023@ServiceProvider(service = StartupActionFactory.class) 024public final class OperationsStartupActionFactory extends AbstractStartupActionFactory { 025 026 @Override 027 public String getTitle(Class<?> clazz, Locale locale) throws IllegalArgumentException { 028 if (clazz.equals(AutomationsTableFrameAction.class)) { 029 return Bundle.getMessage(locale, "StartupAutomationsTableFrameAction"); // NOI18N 030 } else if (clazz.equals(CarsTableAction.class)) { 031 return Bundle.getMessage(locale, "StartupCarsTableAction"); // NOI18N 032 } else if (clazz.equals(EnginesTableAction.class)) { 033 return Bundle.getMessage(locale, "StartupEnginesTableAction"); // NOI18N 034 } else if (clazz.equals(LocationsTableAction.class)) { 035 return Bundle.getMessage(locale, "StartupLocationsTableAction"); // NOI18N 036 } else if (clazz.equals(OperationsSettingsAction.class)) { 037 return Bundle.getMessage(locale, "StartupOperationsSettingsAction"); // NOI18N 038 } else if (clazz.equals(RoutesTableAction.class)) { 039 return Bundle.getMessage(locale, "StartupRoutesTableAction"); // NOI18N 040 } else if (clazz.equals(TrainsScheduleAction.class)) { 041 return Bundle.getMessage(locale, "StartupTrainsScheduleAction"); // NOI18N 042 } else if (clazz.equals(TrainsTableAction.class)) { 043 return Bundle.getMessage(locale, "StartupTrainsTableAction"); // NOI18N 044 } 045 throw new IllegalArgumentException(clazz.getName() + " is not supported by " + this.getClass().getName()); 046 } 047 048 @Override 049 public Class<?>[] getActionClasses() { 050 return new Class[]{AutomationsTableFrameAction.class, 051 CarsTableAction.class, 052 EnginesTableAction.class, 053 LocationsTableAction.class, 054 OperationsSettingsAction.class, 055 RoutesTableAction.class, 056 TrainsScheduleAction.class, 057 TrainsTableAction.class}; 058 } 059 060}