Class StoExToolProviderImpl
- java.lang.Object
-
- org.palladiosimulator.commons.stoex.api.impl.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 Summary
Constructors Constructor Description StoExToolProviderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> Optional<T>
getExtension(String extensionPointId, Class<T> extensionClass)
Get the first found extension matching the given ID.StoexParser
getParser()
Get a StoEx parser.protected com.google.inject.Injector
getStandaloneInjector()
Resolves and caches a standalone injector to be used to create standalone instances of required tools.protected <T> T
getStandaloneInstance(Class<T> type)
Acquires a tool via standalone initialization.protected <T> T
getTool(String extensionPointId, Class<T> extensionClass)
Acquires a Xtext tool either via extension point of via standalone initialization as fallback.
-
-
-
Method Detail
-
getParser
public StoexParser getParser()
Get a StoEx parser.- Specified by:
getParser
in interfaceStoExToolProvider
- Returns:
- The parser instance.
- See Also:
StoexParser
-
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 likeEP_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 emptyOptional
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.
-
-