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.
      • getExecutableExtension

        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.