Package com.e1c.langtool
Class TranslationUtils
java.lang.Object
com.e1c.langtool.TranslationUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanUpMabDbFiles(File file) Clean up MapDB files with it's p-file.static intcomputePoolSize(boolean forced) Compute execution pool size depends on available CPU and RAM memory.Return set of interface language codes for givenproject.static TranslationSourcegetTranslationSource(Object object) Gets the translation source from given object, that can beIAdaptableor has registered adapter toTranslationSource.static org.eclipse.core.resources.IFilegetTranslationSourceFile(ContextTranslationKey contextKey) Gets the translation source file.static booleanisModelLanguage(TranslateLanguage language) Checks if the language is model language.static booleanisValidFeatureForLanguage(FeatureSettings featureSettings, TranslateLanguage language) Checks if the feature described withFeatureSettingsis valid for the language.static booleanisValidValueForCollectModelType(boolean isComputed, boolean isUnknown, boolean isTag, ICollectingParameters.CollectModelType collectModelType) Checks if the value is valid for given collect model type.static voidstartCleanUpMapDbFiles(File file) Start clean up MapDB files in separate job.
-
Method Details
-
getTranslationSource
Gets the translation source from given object, that can beIAdaptableor has registered adapter toTranslationSource.- Parameters:
object- the object, may benull.- Returns:
- the translation source or
nullif cannot be adapted.
-
isModelLanguage
Checks if the language is model language.- Parameters:
language- the language to check, cannot benull- Returns:
- true, if the language is model language
-
isValidFeatureForLanguage
public static boolean isValidFeatureForLanguage(FeatureSettings featureSettings, TranslateLanguage language) Checks if the feature described withFeatureSettingsis valid for the language.- Parameters:
featureSettings- the feature settings, cannot benulllanguage- the language, cannot benull- Returns:
- true, if the feature is valid for the language
-
isValidValueForCollectModelType
public static boolean isValidValueForCollectModelType(boolean isComputed, boolean isUnknown, boolean isTag, ICollectingParameters.CollectModelType collectModelType) Checks if the value is valid for given collect model type.- Parameters:
isComputed- the computed model valueisUnknown- the unknown model valueisTag- the is tag or tag parametercollectModelType- the collect model type, cannot benull- Returns:
true, if the value is valid for collect model type
-
getProjectInterfaceLanguageCodes
Return set of interface language codes for givenproject. Note that main language code are not included into this list.- Parameters:
project- Project, shall not benull.- Returns:
- Set of project's interface language codes.
-
computePoolSize
public static int computePoolSize(boolean forced) Compute execution pool size depends on available CPU and RAM memory.- Parameters:
forced- the forced to get by CPU number, without RAM memory calculation.- Returns:
- the number of threads for the pull
-
getTranslationSourceFile
public static org.eclipse.core.resources.IFile getTranslationSourceFile(ContextTranslationKey contextKey) Gets the translation source file.- Parameters:
contextKey- the context key, cannot benull.- Returns:
- the translation source file, cannot return
null.
-
startCleanUpMapDbFiles
Start clean up MapDB files in separate job. This method doesn't wait the completion of the job.- Parameters:
file- the file, cannot benull.
-
cleanUpMabDbFiles
Clean up MapDB files with it's p-file.- Parameters:
file- the main MapDB file to remove, cannot benull.
-