Class StoExToolProviderImpl

  • All Implemented Interfaces:
    StoExToolProvider

    public class StoExToolProviderImpl
    extends Object
    implements StoExToolProvider
    This implementation delivers StoEx tools provided by Xtext. The implementation tries to use the runtime instances of the tools registered in Eclipse first. If this fails, a standalone initialization takes place. The Eclipse platform versions are bound via extension points that run through the executable provider factory of the UI bundle of the StoEx Xtext implementation. We do not directly depend on the UI bundle to avoid an explicit UI dependency. Even without the UI bundle, the implementation is capable of acquiering the required Xtext services via a standalone initialization.
    • Constructor Detail

      • StoExToolProviderImpl

        public StoExToolProviderImpl()
    • Method Detail

      • getTool

        protected <T> T getTool​(String extensionPointId,
                                Class<T> extensionClass)
        Acquires a Xtext tool either via extension point of via standalone initialization as fallback. Callers are encouraged to cache the results to avoid triggering the costly resolution process too often.
        Type Parameters:
        T - The type of the required tool.
        Parameters:
        extensionPointId - The ID of the extension point for providing the runtime instance of the tool.
        extensionClass - The type of the required tool in form of a class.
        Returns:
        An instance of the required tool.
      • getExtension

        protected <T> Optional<T> getExtension​(String extensionPointId,
                                               Class<T> extensionClass)
        Get the first found extension matching the given ID. The implementation assumes that the extension is given via the attribute named like EP_ATTR_ID.
        Type Parameters:
        T - The type of the required tool.
        Parameters:
        extensionPointId - The ID of the extension point for providing the runtime instance of the tool.
        extensionClass - The type of the required tool in form of a class.
        Returns:
        An Optional containing an instance if one could be found. An empty Optional otherwise.
      • getStandaloneInstance

        protected <T> T getStandaloneInstance​(Class<T> type)
        Acquires a tool via standalone initialization.
        Type Parameters:
        T - The type of the required tool.
        Parameters:
        type - The type of the required tool in form of a class.
        Returns:
        An instance of the required tool.
      • getStandaloneInjector

        protected com.google.inject.Injector getStandaloneInjector()
        Resolves and caches a standalone injector to be used to create standalone instances of required tools.
        Returns:
        The standalone injector.