Package com.e1c.langtool.storage
Class AbstractFileStorageProvider
java.lang.Object
com.e1c.langtool.storage.AbstractFileStorageProvider
- All Implemented Interfaces:
ITranslationStorageProvider
- Direct Known Subclasses:
ContextFileStorageProvider,DictionaryFileStorageProvider
public abstract class AbstractFileStorageProvider
extends Object
implements ITranslationStorageProvider
The abstract class of resource file storage provider with common logic of creating
AbstractFileStorage with
the project settings, track changes of the settings and re-create storages with dispose evicted instance of storage.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.e1c.langtool.storage.ITranslationStorageProvider
ITranslationStorageProvider.ContextStorage, ITranslationStorageProvider.DictionaryStorage, ITranslationStorageProvider.Storage -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ITranslationStorageProvider.StoragecreateStorage(org.eclipse.core.resources.IProject project, String segment) Creates the storage by the given project and segment.protected voiddisposeStorage(org.eclipse.core.resources.IProject project, String segment, ITranslationStorageProvider.Storage storage) Dispose storage if the project settings changed.protected abstract Collection<? extends ResourceStorageSettings>getProjectSettings(org.eclipse.core.resources.IProject project) Gets the project resource storage settings.getStorage(org.eclipse.core.resources.IProject project, String segment) Gets the storage.getStorageDescription(org.eclipse.core.resources.IProject project, String segment) Gets the storage description.getStorageSegments(org.eclipse.core.resources.IProject project) At least one segment ID should be returned to use the provider.voidinitialize(org.eclipse.core.resources.IProject project, List<String> segments) Initialize.booleanisActive()Checks whether it active and can be used or not.protected voidsettingsChanged(org.eclipse.core.resources.IProject project, boolean projectClosed) Process the change of the project settings.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
getProviderId
-
Field Details
-
storageSettingsManager
-
-
Constructor Details
-
AbstractFileStorageProvider
-
-
Method Details
-
isActive
public boolean isActive()Description copied from interface:ITranslationStorageProviderChecks whether it active and can be used or not.- Specified by:
isActivein interfaceITranslationStorageProvider- Returns:
- true, if is active
-
initialize
Description copied from interface:ITranslationStorageProviderInitialize.- Specified by:
initializein interfaceITranslationStorageProvider- Parameters:
project- the projectsegments- the segments
-
getStorageSegments
Description copied from interface:ITranslationStorageProviderAt least one segment ID should be returned to use the provider. String cannot contains `:`, which used for separation provider_id and segment for global "Storage ID" in the project: com.e1c.langtool.storage:common com.e1c.langtool.storage:context- Specified by:
getStorageSegmentsin interfaceITranslationStorageProvider- Parameters:
project- the project- Returns:
- the storage segments
-
getStorageDescription
Description copied from interface:ITranslationStorageProviderGets the storage description.- Specified by:
getStorageDescriptionin interfaceITranslationStorageProvider- Parameters:
project- the projectsegment- the segment- Returns:
- the storage description
-
getStorage
public ITranslationStorageProvider.Storage getStorage(org.eclipse.core.resources.IProject project, String segment) Description copied from interface:ITranslationStorageProviderGets the storage.- Specified by:
getStoragein interfaceITranslationStorageProvider- Parameters:
project- the projectsegment- the segment- Returns:
- the storage
-
settingsChanged
protected void settingsChanged(org.eclipse.core.resources.IProject project, boolean projectClosed) Process the change of the project settings. This method remove evicted storages of the project and dispose them.- Parameters:
project- the project of changed settings, cannot benull.projectClosed- the project closed
-
createStorage
protected abstract ITranslationStorageProvider.Storage createStorage(org.eclipse.core.resources.IProject project, String segment) Creates the storage by the given project and segment.- Parameters:
project- the project, cannot benull.segment- the segment, cannot benull.- Returns:
- the storage, cannot be
null.
-
disposeStorage
protected void disposeStorage(org.eclipse.core.resources.IProject project, String segment, ITranslationStorageProvider.Storage storage) Dispose storage if the project settings changed.- Parameters:
project- the project, cannot benull.segment- the segment, cannot benull.storage- the storage, cannot benull.
-
getProjectSettings
protected abstract Collection<? extends ResourceStorageSettings> getProjectSettings(org.eclipse.core.resources.IProject project) Gets the project resource storage settings.- Parameters:
project- the project, cannot benull.- Returns:
- the project settings, can return
null.
-