Class RecentFilesWithEncodingHandler<M>

    • Field Detail

      • RECENTFILES_COUNT

        public static final String RECENTFILES_COUNT
        the property for storing the number of recent files.
        See Also:
        Constant Field Values
      • RECENTFILES_PREFIX

        public static final String RECENTFILES_PREFIX
        the property prefix for a recent file.
        See Also:
        Constant Field Values
      • m_MinNumParentDirs

        protected int m_MinNumParentDirs
        the minimum number of parent directories to use.
    • Constructor Detail

      • RecentFilesWithEncodingHandler

        public RecentFilesWithEncodingHandler​(String propsFile,
                                              M menu)
        Initializes the handler with a maximum of 5 items.
        Parameters:
        propsFile - the props file to store the files in
        menu - the menu to add the recent files as subitems to
      • RecentFilesWithEncodingHandler

        public RecentFilesWithEncodingHandler​(String propsFile,
                                              int maxCount,
                                              M menu)
        Initializes the handler.
        Parameters:
        propsFile - the props file to store the files in
        maxCount - the maximum number of files to keep in menu
        menu - the menu to add the recent files as subitems to
      • RecentFilesWithEncodingHandler

        public RecentFilesWithEncodingHandler​(String propsFile,
                                              String propPrefix,
                                              int maxCount,
                                              M menu)
        Initializes the handler.
        Parameters:
        propsFile - the props file to store the files in
        propPrefix - the properties prefix, use null to ignore
        maxCount - the maximum number of files to keep in menu
        menu - the menu to add the recent files as subitems to
    • Method Detail

      • check

        protected boolean check​(String item)
        Checks the item after obtaining from the props file.

        File must exist.
        Overrides:
        check in class AbstractRecentItemsHandler<M,​String>
        Parameters:
        item - the item to check
        Returns:
        true if checks passed
      • determineMinimumNumberOfParentDirs

        protected int determineMinimumNumberOfParentDirs()
        Determines the minimum number of parent directories that need to be included in the filename to make the filenames in the menu distinguishable.
        Returns:
        the minimum number of parent directories, -1 means full path
      • getFile

        public static File getFile​(String item)
        Returns the file part of the item.
        Parameters:
        item - the item to get the file from
        Returns:
        the file
      • getEncoding

        public static String getEncoding​(String item)
        Returns the file encoding part of the item.
        Parameters:
        item - the item to get the encoding from
        Returns:
        the encoding