Class LoadRecentProject

All Implemented Interfaces:
Command

@AutoService(Command.class) public class LoadRecentProject extends Load
Handles the loading of recent files, and also the content and visibility of menu items for loading the recent files
  • Constructor Details

    • LoadRecentProject

      public LoadRecentProject()
  • Method Details

    • getActionNames

      public Set<String> getActionNames()
      Specified by:
      getActionNames in interface Command
      Overrides:
      getActionNames in class Load
    • doActionAfterCheck

      public void doActionAfterCheck(ActionEvent e)
      Description copied from class: AbstractActionWithNoRunningTest
      Called to handle ActionEvent only if no test is running
      Overrides:
      doActionAfterCheck in class Load
      Parameters:
      e - ActionEvent
    • getRecentFileMenuItems

      public static List<JComponent> getRecentFileMenuItems()
      Get the menu items to add to the menu bar, to get recent file functionality
      Returns:
      a List of JMenuItem, representing recent files. JMenuItem may not be visible
    • updateRecentFileMenuItems

      public static void updateRecentFileMenuItems(List<JComponent> menuItems, String loadedFileName)
      Update the content and visibility of the menu items for recent files
      Parameters:
      menuItems - the JMenuItem to update
      loadedFileName - the file name of the project file that has just been loaded
    • getRecentFile

      public static String getRecentFile(int index)
      Get the full path to the recent file where index 0 is the most recent
      Parameters:
      index - the index of the recent file
      Returns:
      full path to the recent file at index
    • hasVisibleMenuItem

      public static boolean hasVisibleMenuItem(List<? extends JComponent> fileLoadRecentFiles)
      Parameters:
      fileLoadRecentFiles - List of JMenuItem
      Returns:
      true if at least on JMenuItem is visible