Package com.e1c.langtool.storage
Class GlobalEditingContext
java.lang.Object
com.e1c.langtool.storage.GlobalEditingContext
- All Implemented Interfaces:
IEditingContext
-
Constructor Summary
ConstructorsConstructorDescriptionGlobalEditingContext(org.eclipse.core.resources.IProject project, ITranslationStorageManager translationStorageManager) -
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.
-
Constructor Details
-
GlobalEditingContext
public GlobalEditingContext(org.eclipse.core.resources.IProject project, ITranslationStorageManager translationStorageManager)
-
-
Method Details
-
getTranslation
public String getTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Description copied from interface:IEditingContextGets the translation from the storage.- Specified by:
getTranslationin interfaceIEditingContext- 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
public void setTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language, String translation) Description copied from interface:IEditingContextSets the translation to the editing context.- Specified by:
setTranslationin interfaceIEditingContext- Parameters:
storageId- the storage id, cannot benull.translationKey- the translation key, cannot benull.language- the language, cannot benull.translation- the translation, may benull.
-
removeTranslation
public void removeTranslation(StorageID storageId, TranslationKey translationKey, TranslateLanguage language) Description copied from interface:IEditingContextRemoves the translation by given translation key and language in the storage.- Specified by:
removeTranslationin interfaceIEditingContext- Parameters:
storageId- the storage id, cannot benull.translationKey- the translation key, cannot benull.language- the language, cannot benull.
-
getProject
public org.eclipse.core.resources.IProject getProject()Description copied from interface:IEditingContextGets the project of editing context.- Specified by:
getProjectin interfaceIEditingContext- Returns:
- the project
-
isDirty
public boolean isDirty()Description copied from interface:IEditingContextReturnstrueif the context is dirty,false- otherwise.- Specified by:
isDirtyin interfaceIEditingContext- Returns:
trueif the context is dirty,false- otherwise.
-
save
public void save()Description copied from interface:IEditingContextSaves the context.- Specified by:
savein interfaceIEditingContext
-
getUndoContext
public org.eclipse.core.commands.operations.IUndoContext getUndoContext()Description copied from interface:IEditingContextReturns theIUndoContextto support the undo/redo operations.- Specified by:
getUndoContextin interfaceIEditingContext- Returns:
- the
IUndoContextto support the undo/redo operations ornullif the context is not initialized or already disposed.
-
dispose
public void dispose()Description copied from interface:IEditingContextDisposes the context.- Specified by:
disposein interfaceIEditingContext
-
isDisposed
public boolean isDisposed()Description copied from interface:IEditingContextReturnstrueif the context is disposed,false- otherwise.- Specified by:
isDisposedin interfaceIEditingContext- Returns:
trueif the context is disposed,false- otherwise.
-
addListener
Description copied from interface:IEditingContextAdds the specifiedlistener.- Specified by:
addListenerin interfaceIEditingContext- Parameters:
listener- the listener to add, cannot benull.
-
removeListener
Description copied from interface:IEditingContextRemoves the specifiedlistener.- Specified by:
removeListenerin interfaceIEditingContext- Parameters:
listener- the listener to remove, cannot benull.
-