Class DictionaryFileStorage
java.lang.Object
com.e1c.langtool.storage.AbstractFileStorage
com.e1c.langtool.internal.storage.DictionaryFileStorage
- All Implemented Interfaces:
ITranslationStorageProvider.DictionaryStorage,ITranslationStorageProvider.Storage
public class DictionaryFileStorage
extends AbstractFileStorage
implements ITranslationStorageProvider.DictionaryStorage
The default implementation of file resource storage that stores only non-context dictionary data.
Storage get translation file path by
settings file path and
select external project by the translation language.
Implementation supports to load file's data according to configured format in storage settings.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider.Storage
ITranslationStorageProvider.Storage.Type -
Field Summary
Fields inherited from class com.e1c.langtool.storage.AbstractFileStorage
batchUpdate, fileMediator, id, project -
Constructor Summary
ConstructorsConstructorDescriptionDictionaryFileStorage(org.eclipse.core.resources.IProject project, StorageID id, DictionaryStorageSettings settings, ITranslatingProjectManager translatingProjectManager, IStorageSettingsManager storageSettingsManager, ITranslationStorageManager translationStorageManager) -
Method Summary
Modifier and TypeMethodDescriptiongetComment(TranslationKey key, TranslateLanguage language) Gets the comment by the translation key.getTranslation(FeatureValue source, TranslateLanguage language) Gets the translation from storage.getTranslation(TranslationKey key, TranslateLanguage language) Gets the translation from the dictionary storage.protected com.google.inject.Provider<ITranslationFileEditorFactory<?>>getType()Returns the type of translation storage.booleanhasKeyForValue(String value, TranslateLanguage language, TranslationKey skipKey) Checks that dictionary has key for the value except the given skip key.voidmoveComment(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move only comment from one translation key to another.voidmoveTranslation(FeatureValue fromSource, FeatureValue toSource, TranslateLanguage language, boolean autoSave) Move translation inside the storage from one key to enother.voidmoveTranslation(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Move translation from one key to another inside this single storage.voidremoveComment(TranslationKey key, TranslateLanguage language, boolean autoSave) Removes the comment of the translation key.voidremoveTranslation(FeatureValue source, TranslateLanguage language, boolean autoSave) Removes the translation from storage.voidremoveTranslation(TranslationKey key, TranslateLanguage language, boolean autoSave) Removes the translation.Map<org.eclipse.core.resources.IFile,byte[]> saveFiles(TranslateLanguage language, com.google.common.hash.HashFunction hashFunction) TODO JavaDocvoidsetComment(TranslationKey key, TranslateLanguage language, String comment, boolean autoSave) Sets the comment for some translation key.voidsetTranslation(FeatureValue source, TranslateLanguage language, String translation, boolean autoSave) Sets the translation.voidsetTranslation(TranslationKey key, TranslateLanguage language, String translation, boolean autoSave) Sets the translation of dictionary storage.Methods inherited from class com.e1c.langtool.storage.AbstractFileStorage
addBatchUpdateNotification, addValueChangedListener, beginBatchUpdate, dispose, endBatchUpdate, firePostValueChanged, getId, getSegment, isReadOnly, removeValueChangedListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider.Storage
addBatchUpdateNotification, addValueChangedListener, beginBatchUpdate, endBatchUpdate, getId, getSegment, isReadOnly, removeValueChangedListener
-
Constructor Details
-
DictionaryFileStorage
public DictionaryFileStorage(org.eclipse.core.resources.IProject project, StorageID id, DictionaryStorageSettings settings, ITranslatingProjectManager translatingProjectManager, IStorageSettingsManager storageSettingsManager, ITranslationStorageManager translationStorageManager)
-
-
Method Details
-
getTranslation
Description copied from interface:ITranslationStorageProvider.StorageGets the translation from storage.- Specified by:
getTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Specified by:
getTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the language- Returns:
- the translation
-
setTranslation
public void setTranslation(FeatureValue source, TranslateLanguage language, String translation, boolean autoSave) Description copied from interface:ITranslationStorageProvider.StorageSets the translation.- Specified by:
setTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Specified by:
setTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the languagetranslation- the translation
-
removeTranslation
Description copied from interface:ITranslationStorageProvider.StorageRemoves the translation from storage.- Specified by:
removeTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Specified by:
removeTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
source- the source feature valuelanguage- the language
-
moveTranslation
public void moveTranslation(FeatureValue fromSource, FeatureValue toSource, TranslateLanguage language, boolean autoSave) Description copied from interface:ITranslationStorageProvider.StorageMove translation inside the storage from one key to enother.- Specified by:
moveTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Specified by:
moveTranslationin interfaceITranslationStorageProvider.Storage- Parameters:
fromSource- the source feature value to move fromtoSource- the source feature value to move tolanguage- the language
-
getType
Description copied from interface:ITranslationStorageProvider.StorageReturns the type of translation storage.- Specified by:
getTypein interfaceITranslationStorageProvider.DictionaryStorage- Specified by:
getTypein interfaceITranslationStorageProvider.Storage- Returns:
- the type of storage
- See Also:
-
getTranslation
Description copied from interface:ITranslationStorageProvider.DictionaryStorageGets the translation from the dictionary storage.- Specified by:
getTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.- Returns:
- the translation, can return
null.
-
setTranslation
public void setTranslation(TranslationKey key, TranslateLanguage language, String translation, boolean autoSave) Description copied from interface:ITranslationStorageProvider.DictionaryStorageSets the translation of dictionary storage.- Specified by:
setTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.translation- the translation, can benull.
-
removeTranslation
Description copied from interface:ITranslationStorageProvider.DictionaryStorageRemoves the translation.- Specified by:
removeTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.
-
moveTranslation
public void moveTranslation(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Description copied from interface:ITranslationStorageProvider.DictionaryStorageMove translation from one key to another inside this single storage. Attantion! Implementation should move the comment of source translation key to new one.- Specified by:
moveTranslationin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
fromKey- the from translation key, cannot benull.toKey- the to translation key, cannot benull.language- the language, cannot benull.
-
getComment
Description copied from interface:ITranslationStorageProvider.DictionaryStorageGets the comment by the translation key.- Specified by:
getCommentin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the key, cannot benull.language- the language, cannot benull.- Returns:
- the comment, can return
null.
-
setComment
public void setComment(TranslationKey key, TranslateLanguage language, String comment, boolean autoSave) Description copied from interface:ITranslationStorageProvider.DictionaryStorageSets the comment for some translation key.- Specified by:
setCommentin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.comment- the comment, can benull.
-
removeComment
Description copied from interface:ITranslationStorageProvider.DictionaryStorageRemoves the comment of the translation key.- Specified by:
removeCommentin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
key- the translation key, cannot benull.language- the language, cannot benull.
-
moveComment
public void moveComment(TranslationKey fromKey, TranslationKey toKey, TranslateLanguage language, boolean autoSave) Description copied from interface:ITranslationStorageProvider.DictionaryStorageMove only comment from one translation key to another. Note! The translation value of the source key will not move with it's comment.- Specified by:
moveCommentin interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
fromKey- the from translation key, cannot benull.toKey- the to translation key, cannot benull.language- the language, cannot benull.
-
saveFiles
public Map<org.eclipse.core.resources.IFile,byte[]> saveFiles(TranslateLanguage language, com.google.common.hash.HashFunction hashFunction) Description copied from interface:ITranslationStorageProvider.DictionaryStorageTODO JavaDoc- Specified by:
saveFilesin interfaceITranslationStorageProvider.DictionaryStorage- Returns:
-
hasKeyForValue
Description copied from interface:ITranslationStorageProvider.DictionaryStorageChecks that dictionary has key for the value except the given skip key.- Specified by:
hasKeyForValuein interfaceITranslationStorageProvider.DictionaryStorage- Parameters:
value- the value, cannot benull.language- the translate language, cannot benull.skipKey- the key which need to skip in the check, can benull.- Returns:
- true, if storage has key for the value
-
getTranslationFileEditorFactory
protected com.google.inject.Provider<ITranslationFileEditorFactory<?>> getTranslationFileEditorFactory(StorageSettings settings) - Specified by:
getTranslationFileEditorFactoryin classAbstractFileStorage
-