Package com.e1c.langtool.storage
Interface IEditingContext
- All Known Implementing Classes:
GlobalEditingContext
public interface IEditingContext
Common interface for objects of editing translation for
FeatureValue and language code.
The context is responsible for storing translation in ITranslationStorageProvider.Storage according user settings of current
editing storage.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(IEditingContextListener listener) Adds the specifiedlistener.voiddispose()Disposes the context.org.eclipse.core.resources.IProjectGets the project of editing context.getTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Gets the translation from the storage.org.eclipse.core.commands.operations.IUndoContextReturns theIUndoContextto support the undo/redo operations.booleanisDirty()Returnstrueif the context is dirty,false- otherwise.booleanReturnstrueif the context is disposed,false- otherwise.voidremoveListener(IEditingContextListener listener) Removes the specifiedlistener.voidremoveTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Removes the translation by given translation key and language in the storage.voidsave()Saves the context.voidsetTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language, String translation) Sets the translation to the editing context.
-
Method Details
-
getTranslation
String getTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Gets the translation from the storage.- Parameters:
storageId- the storage id, cannot benull.translationKey- the translation key, cannot benull.language- the language, cannot benull.- Returns:
- the translation, may return
null.
-
setTranslation
void setTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language, String translation) Sets the translation to the editing context.- Parameters:
storageId- the storage id, cannot benull.translationKey- the translation key, cannot benull.language- the language, cannot benull.translation- the translation, may benull.
-
removeTranslation
void removeTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Removes the translation by given translation key and language in the storage.- Parameters:
storageId- the storage id, cannot benull.translationKey- the translation key, cannot benull.language- the language, cannot benull.
-
getProject
org.eclipse.core.resources.IProject getProject()Gets the project of editing context.- Returns:
- the project
-
isDirty
boolean isDirty()Returnstrueif the context is dirty,false- otherwise.- Returns:
trueif the context is dirty,false- otherwise.
-
save
void save()Saves the context. -
getUndoContext
org.eclipse.core.commands.operations.IUndoContext getUndoContext()Returns theIUndoContextto support the undo/redo operations.- Returns:
- the
IUndoContextto support the undo/redo operations ornullif the context is not initialized or already disposed.
-
dispose
void dispose()Disposes the context. -
isDisposed
boolean isDisposed()Returnstrueif the context is disposed,false- otherwise.- Returns:
trueif the context is disposed,false- otherwise.
-
addListener
Adds the specifiedlistener.- Parameters:
listener- the listener to add, cannot benull.
-
removeListener
Removes the specifiedlistener.- Parameters:
listener- the listener to remove, cannot benull.
-