Package com.e1c.langtool.storage
Class AbstractFileStorage
java.lang.Object
com.e1c.langtool.storage.AbstractFileStorage
- All Implemented Interfaces:
ITranslationStorageProvider.Storage
- Direct Known Subclasses:
ContextFileStorage,DictionaryFileStorage
public abstract class AbstractFileStorage
extends Object
implements ITranslationStorageProvider.Storage
The abstract class of resource file storage, that allows to use common logic to track external file changing events,
or save asynchronously, storage batch mode, firing changes events and etc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider.Storage
ITranslationStorageProvider.Storage.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicBooleanprotected final CachedFileMediatorprotected final StorageIDprotected final org.eclipse.core.resources.IProject -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFileStorage(org.eclipse.core.resources.IProject project, StorageID id, StorageSettings settings) Instantiates a new abstract file storage. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the batch update notification.voidAdds a listener for post value changes in this storage.voidInform storage about planned batch update.voiddispose()voidEnd storage batch update.protected voidNotifies any post value changed listeners that a post change event has been received.getId()Gets the id of storage.The unique segment.protected abstract com.google.inject.Provider<ITranslationFileEditorFactory<?>>booleanChecks if the storage is read only.voidRemoves the given listener for post value changes from this storage.Methods 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
getTranslation, getType, moveTranslation, removeTranslation, setTranslation
-
Field Details
-
fileMediator
-
project
protected final org.eclipse.core.resources.IProject project -
id
-
batchUpdate
-
-
Constructor Details
-
AbstractFileStorage
public AbstractFileStorage(org.eclipse.core.resources.IProject project, StorageID id, StorageSettings settings) Instantiates a new abstract file storage.- Parameters:
project- the project, cannot benull.id- the storage id, cannot benull.settings- the settings, cannot benull.
-
-
Method Details
-
getId
Description copied from interface:ITranslationStorageProvider.StorageGets the id of storage.- Specified by:
getIdin interfaceITranslationStorageProvider.Storage- Returns:
- the id. Cannot return
null.
-
getSegment
Description copied from interface:ITranslationStorageProvider.StorageThe unique segment.- Specified by:
getSegmentin interfaceITranslationStorageProvider.Storage- Returns:
- the segment
-
isReadOnly
public boolean isReadOnly()Description copied from interface:ITranslationStorageProvider.StorageChecks if the storage is read only.- Specified by:
isReadOnlyin interfaceITranslationStorageProvider.Storage- Returns:
- true, if the storage is read only
-
addValueChangedListener
Description copied from interface:ITranslationStorageProvider.StorageAdds a listener for post value changes in this storage. Has no effect if an identical listener is already registered.- Specified by:
addValueChangedListenerin interfaceITranslationStorageProvider.Storage- Parameters:
listener- the listener
-
removeValueChangedListener
Description copied from interface:ITranslationStorageProvider.StorageRemoves the given listener for post value changes from this storage. Has no effect if an identical listener is not registered.- Specified by:
removeValueChangedListenerin interfaceITranslationStorageProvider.Storage- Parameters:
listener- the listener
-
addBatchUpdateNotification
Description copied from interface:ITranslationStorageProvider.StorageAdds the batch update notification.- Specified by:
addBatchUpdateNotificationin interfaceITranslationStorageProvider.Storage- Parameters:
event- the event, cannot benull
-
beginBatchUpdate
public void beginBatchUpdate()Description copied from interface:ITranslationStorageProvider.StorageInform storage about planned batch update. Storage implementation may use this information for work optimization. After batch update doneendUpdate()must be called. Nested updates supported. Update mode end when lastendUpdate()paired to called.- Specified by:
beginBatchUpdatein interfaceITranslationStorageProvider.Storage
-
endBatchUpdate
public void endBatchUpdate()Description copied from interface:ITranslationStorageProvider.StorageEnd storage batch update.- Specified by:
endBatchUpdatein interfaceITranslationStorageProvider.Storage
-
dispose
public void dispose() -
firePostValueChanged
Notifies any post value changed listeners that a post change event has been received. Only listeners registered at the time this method is called are notified.- Parameters:
event- a value changed event- See Also:
-
getTranslationFileEditorFactory
protected abstract com.google.inject.Provider<ITranslationFileEditorFactory<?>> getTranslationFileEditorFactory(StorageSettings settings)
-