Class HelpManager

    • Method Detail

      • getHelpUrl

        public Map<String,​ObjectgetHelpUrl​(String family,
                                                   String id,
                                                   String lang)
                                            throws Exception
        Get the url for help for this family/id. The result is a map containing "url", "error" and "error-cause"
        Parameters:
        family - the family for this link (for example an extension point)
        id - id in the family (must be unique in the family)
        lang - requested language
        Returns:
        an Map containg the URL for help. If this language is not found, a default language will be searched, then any language. If nothing is found, the url will be null.
        Throws:
        Exception - impossible to read the default help file
      • getSearchUrl

        public Map<String,​ObjectgetSearchUrl()
        Get the search url
        Returns:
        The result (map with an url key, or possible error)
      • getHelp

        public String getHelp​(String family,
                              String id,
                              String lang)
                       throws Exception
        Get the url for help for this family/id or null if not found
        Parameters:
        family - the family for this link (for example an extension point)
        id - id in the family (must be unique in the family)
        lang - requested language
        Returns:
        an URL for help. If this language is not found, a default language will be searched, then any language, and null if really nothing is found
        Throws:
        Exception - impossible to read the default help file
      • getHelp

        public String getHelp​(String family,
                              String id,
                              List<String> languages)
                       throws Exception
        Get the url for help for this family/id or null if not found
        Parameters:
        family - the family for this link (for example an extension point)
        id - id in the family (must be unique in the family)
        languages - Ordered list of requested languages
        Returns:
        an URL for help. If no language is found, a default language will be searched, then any other language, and null if really nothing is found
        Throws:
        Exception - impossible to read the default help file
      • updateFile

        public void updateFile​(String sourceUrl,
                               Source source,
                               InputStream is)
                        throws Exception
        Description copied from interface: FileReloader
        Update the file, the sourceUrl is only there if you manage multiple files, the Configuration object is already present to read it
        Specified by:
        updateFile in interface FileReloader
        Parameters:
        sourceUrl - the url of the file.
        source - the source to read, can be null if no file was read
        is - the input stream to read, can be null if no file was read
        Throws:
        Exception - something went wrong while reading the inputstream
      • getId

        public String getId​(String sourceUrl)
        Description copied from interface: FileReloader
        Get an unique ID for this File Reloader
        Specified by:
        getId in interface FileReloader
        Parameters:
        sourceUrl - this is passed as an argument if your class read multiple files. If it reads only one file, the full class name can be a good enough ID
        Returns:
        an unique ID
      • parseConfigFile

        public Map<String,​HelpLinkparseConfigFile​(Configuration configuration,
                                                          String pluginName,
                                                          String featureName)
        parse a configuration file for a plugin (plugin name and id)
        Parameters:
        configuration - the configuration
        pluginName - Unique identifier for the plugin hosting the extension (for logs)
        featureName - Unique feature identifier (unique for a given pluginName) (for logs)
        Returns:
        a map of HelpLink.uniqueId HelpLink representing the help URLs found in the configuration file
      • _addLink

        private HelpLink _addLink​(Configuration linkConfiguration,
                                  String pluginName,
                                  String featureName)
        adds a link in the global plugin map
        Parameters:
        linkConfiguration - link node in the configuration
        pluginName - Unique identifier for the plugin hosting the extension (for logs)
        featureName - Unique feature identifier (unique for a given pluginName) (for logs)
        Returns:
        the link or null