Class ExtensionHelper


  • public final class ExtensionHelper
    extends Object
    Helper class for coping with Eclipse extension points and extensions. TODO ExtensionHelper lacks advanced filtering options. Use Java 1.8 Lambda expressions. [Lehrig]
    • Method Detail

      • getAttributes

        public static List<String> getAttributes​(String extensionPointID,
                                                 String elementName,
                                                 String attributeName)
        Gets all attributes registered at a given extension point at a given element and conforming to a given attribute.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get attributes from.
        elementName - the name of the configuration element.
        attributeName - the name of the attribute.
        Returns:
        a list of attributes conforming to the given parameters.
      • getExecutableExtensions

        public static <DATA_TYPE> List<DATA_TYPE> getExecutableExtensions​(String extensionPointID,
                                                                          String attributeName)
        Gets all executable extensions registered at a given extension point conforming to a given attribute.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        attributeName - the name of the attribute.
        Returns:
        list of executable extension for the given attribute.
      • getExecutableExtension

        public static <DATA_TYPE> DATA_TYPE getExecutableExtension​(String extensionPointID,
                                                                   String attributeName,
                                                                   String filterAttributeName,
                                                                   String filterAttributeValue)
        Gets all executable extensions registered at a given extension point conforming to a given attribute and filtered by the given attribute and its value.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        attributeName - the name of the attribute.
        filterAttributeName - the attribute to be used for filtering.
        filterAttributeValue - the atrribute's value to be used for filtering. Found attributes have to equal this value in case they should be chosen.
        Returns:
        list of executable extension for the given attribute.
      • getExecutableExtensions

        public static <DATA_TYPE> List<DATA_TYPE> getExecutableExtensions​(String extensionPointID,
                                                                          String elementName,
                                                                          String attributeName)
        Gets all executable extensions registered at a given extension point at a given element and conforming to a given attribute.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        elementName - the name of the configuration element.
        attributeName - the name of the attribute.
        Returns:
        list of executable extension for the given attribute.
      • getExecutableExtensions

        public static <DATA_TYPE> List<DATA_TYPE> getExecutableExtensions​(String extensionPointID,
                                                                          String elementName,
                                                                          String attributeName,
                                                                          String filterAttributeName,
                                                                          String filterAttributeValue,
                                                                          Class<DATA_TYPE> extensionType)
        Gets all executable extensions registered at a given extension point at a given element and conforming to a given attribute and filtered by the given attribute and its value.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        elementName - the name of the configuration element.
        attributeName - the name of the attribute.
        filterAttributeName - the attribute to be used for filtering.
        filterAttributeValue - the atrribute's value to be used for filtering. Found attributes have to equal this value in case they should be chosen.
        extensionType - the extension base class. Extensions not conforming to the base class will be silently ignored.
        Returns:
        a list of executable extensions matching to all selection criteria defined by this method's parameters.
      • getExecutableExtension

        public static <DATA_TYPE> DATA_TYPE getExecutableExtension​(String extensionPointID,
                                                                   String elementName,
                                                                   String attributeName,
                                                                   String filterAttributeName,
                                                                   String filterAttributeValue,
                                                                   Class<DATA_TYPE> extensionType)
        Gets an executable extension registered at a given extension point at a given element and conforming to a given attribute and filtered by the given attribute and its value.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        elementName - the name of the configuration element.
        attributeName - the name of the attribute.
        filterAttributeName - the attribute to be used for filtering.
        filterAttributeValue - the atrribute's value to be used for filtering. Found attributes have to equal this value in case they should be chosen.
        extensionType - the base type of the extension. Extensions not conforming to the base class will be silently ignored.
        Returns:
        an executable extension matching to all selection criteria defined by this method's parameters.
      • getExecutableExtension

        @Deprecated
        public static <DATA_TYPE> DATA_TYPE getExecutableExtension​(String extensionPointID,
                                                                   String elementName,
                                                                   String attributeName,
                                                                   String filterAttributeName,
                                                                   String filterAttributeValue)
        Gets an executable extension registered at a given extension point at a given element and conforming to a given attribute and filtered by the given attribute and its value.
        Type Parameters:
        DATA_TYPE - the data type of the executable extension.
        Parameters:
        extensionPointID - the extension point identifier; pointing to the extension point to get executable extensions from.
        elementName - the name of the configuration element.
        attributeName - the name of the attribute.
        filterAttributeName - the attribute to be used for filtering.
        filterAttributeValue - the atrribute's value to be used for filtering. Found attributes have to equal this value in case they should be chosen.
        Returns:
        an executable extension matching to all selection criteria defined by this method's parameters.