Class ProjectTranslationProvider
java.lang.Object
com.e1c.langtool.v8.dt.translator.ProjectTranslationProvider
- All Implemented Interfaces:
IProjectTranslationProvider
- Direct Known Subclasses:
ExtensionProjectTranslationProvider,ExternalProjectTranslationProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IComputedNameServiceprotected IComputedNameTranslationServiceprotected ITranslationFeatureKeyProviderprotected IgnoreTranslationCheckingServiceprotected TranslationPreferencesprotected IResourceLookupprotected ITranslationStorageManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProjectTranslationProvider(ITranslatedV8Project translatedProject) -
Method Summary
Modifier and TypeMethodDescriptionGet all caches instancesstatic ProjectTranslationProvidercreate(ITranslatedV8Project translatedProject) Low-level factory to creates the ProjectTranslationProvider instance.<T extends SessionCache>
TGets the cache instance of given type.getOptionalTranslation(org.eclipse.emf.ecore.EObject source, ContextTranslationKey key, TranslateLanguage language) Gets the translation for the givenContextTranslationKeyand if has no translation stored inITranslationStorageProvider.Storagetries to compute translation by give sourceEObject.getOptionalTranslation(org.eclipse.emf.ecore.EObject source, EFeatureSettings featureSettings, TranslateLanguage language) Gets the translation for the given sourceEObject.Gets the translated V8 project.protected IProjectTranslationReaderGets the reader.protected org.eclipse.core.resources.IProjectGets the source project.getStoredTranslation(ContextTranslationKey key, TranslateLanguage language, ITranslationStorageProvider.Storage.Type... storageTypes) Gets the stored translation directly from storages of project.protected StringgetStoredTranslationInternal(ContextTranslationKey key, TranslateLanguage language, ITranslationStorageProvider.Storage.Type... storageTypes) Gets the translation directly from storages.getTranslation(org.eclipse.emf.ecore.EObject source, ContextTranslationKey key, TranslateLanguage language) Gets the translation for the givenContextTranslationKeyand if has no translation stored inITranslationStorageProvider.Storagetries to compute translation by give sourceEObject.getTranslation(org.eclipse.emf.ecore.EObject source, EFeatureSettings featureSettings, TranslateLanguage language) Gets the translation for the given sourceEObject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.v8.dt.translator.IProjectTranslationProvider
dispose
-
Field Details
-
resourceLookup
-
featureKeyProvider
-
computedNameService
-
computedNameTranslationService
-
preferences
-
ignoreService
-
storageManager
-
-
Constructor Details
-
ProjectTranslationProvider
-
-
Method Details
-
create
Low-level factory to creates the ProjectTranslationProvider instance.- Parameters:
translatedProject- the translated project- Returns:
- the project translation provider
-
getProject
Description copied from interface:IProjectTranslationProviderGets the translated V8 project.- Specified by:
getProjectin interfaceIProjectTranslationProvider- Returns:
- the project, cannot return
null.
-
getStoredTranslation
public String getStoredTranslation(ContextTranslationKey key, TranslateLanguage language, ITranslationStorageProvider.Storage.Type... storageTypes) Description copied from interface:IProjectTranslationProviderGets the stored translation directly from storages of project.- Specified by:
getStoredTranslationin interfaceIProjectTranslationProvider- Parameters:
key- the context translation key, cannot benull.language- the language to translate into, cannot benull.storageTypes- the storage types, may benullfor all types of stoarages.- Returns:
- the stored translation, can return
null.
-
getTranslation
public String getTranslation(org.eclipse.emf.ecore.EObject source, EFeatureSettings featureSettings, TranslateLanguage language) Description copied from interface:IProjectTranslationProviderGets the translation for the given sourceEObject. It compute feature key and createsFeatureValueto get stored translation inITranslationStorageProvider.Storage- Specified by:
getTranslationin interfaceIProjectTranslationProvider- Parameters:
source- the source, cannot benull.featureSettings- the feature settings, cannot benull.language- the language, cannot benull.- Returns:
- the translation, may return
nullif has no translation.
-
getOptionalTranslation
public Optional<String> getOptionalTranslation(org.eclipse.emf.ecore.EObject source, EFeatureSettings featureSettings, TranslateLanguage language) Description copied from interface:IProjectTranslationProviderGets the translation for the given sourceEObject. It compute feature key and createsFeatureValueto get stored translation inITranslationStorageProvider.Storage- Specified by:
getOptionalTranslationin interfaceIProjectTranslationProvider- Parameters:
source- the source, cannot benull.featureSettings- the feature settings, cannot benull.language- the language, cannot benull.- Returns:
- the optional translation, cannot return
null.
-
getOptionalTranslation
public Optional<String> getOptionalTranslation(org.eclipse.emf.ecore.EObject source, ContextTranslationKey key, TranslateLanguage language) Description copied from interface:IProjectTranslationProviderGets the translation for the givenContextTranslationKeyand if has no translation stored inITranslationStorageProvider.Storagetries to compute translation by give sourceEObject.- Specified by:
getOptionalTranslationin interfaceIProjectTranslationProvider- Parameters:
source- the source object, cannot benull.key- the context translation key of the source eObject, cannot benull.language- the language to translate into, cannot benull.- Returns:
- the optional translation, cannot return
null.
-
getTranslation
public String getTranslation(org.eclipse.emf.ecore.EObject source, ContextTranslationKey key, TranslateLanguage language) Description copied from interface:IProjectTranslationProviderGets the translation for the givenContextTranslationKeyand if has no translation stored inITranslationStorageProvider.Storagetries to compute translation by give sourceEObject.- Specified by:
getTranslationin interfaceIProjectTranslationProvider- Parameters:
source- the source object, cannot benull.key- the context translation key of the source eObject, cannot benull.language- the language to translate into, cannot benull.- Returns:
- the translation
-
getCache
Description copied from interface:IProjectTranslationProviderGets the cache instance of given type.- Specified by:
getCachein interfaceIProjectTranslationProvider- Type Parameters:
T- the generic type of the cache- Parameters:
clazz- the class of the cache, cannot benull.- Returns:
- the existing or newly created cache instance, cannot return
null.
-
allCaches
Description copied from interface:IProjectTranslationProviderGet all caches instances- Specified by:
allCachesin interfaceIProjectTranslationProvider- Returns:
- the collection of session caches. The collection cannot be modified, cannot return
null. - See Also:
-
getStoredTranslationInternal
protected String getStoredTranslationInternal(ContextTranslationKey key, TranslateLanguage language, ITranslationStorageProvider.Storage.Type... storageTypes) Gets the translation directly from storages.- Parameters:
key- the key, cannot benull.language- the language, cannot benull.storageTypes- the storage types, can benullor empty array for all types.- Returns:
- the stored translation, should not return
null
-
getReader
Gets the reader.- Returns:
- the reader, cannot be
null
-
getSourceProject
protected org.eclipse.core.resources.IProject getSourceProject()Gets the source project.- Returns:
- the source project, cannot be
null
-