Class AbstractPropertiesFileEditor<T>
java.lang.Object
com.e1c.langtool.storage.properties.AbstractPropertiesFileEditor<T>
- Type Parameters:
T- the type of data model
- All Implemented Interfaces:
IFileEditor<T>
- Direct Known Subclasses:
PropertiesContextFileEditor,PropertiesDictionaryFileEditor
The abstract file editor for JAVA-properties file format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final org.eclipse.core.resources.IFileprotected static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPropertiesFileEditor(org.eclipse.core.resources.IFile file) Instantiates a new abstract properties file editor. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Delete storage file, associated with this object.org.eclipse.core.resources.IFilegetFile()Gets the file that was loaded.booleanisDirty()Checks if the file is dirty.voidload()Load from the resource file.voidprotected StringloadConvert(char[] in, int off, int len, char[] convtBuf) protected abstract voidloadInternal(com.e1c.langtool.storage.properties.LineReader lr) Load content form line reader.voidMark the file as dirty.byte[]save(com.google.common.hash.HashFunction hashFunction, org.eclipse.core.runtime.IProgressMonitor monitor) Store translations to the file.voidsave(org.eclipse.core.runtime.IProgressMonitor monitor) Store translations to the file.protected StringsaveConvert(String theString, boolean escapeSpaceAndDot) Convert string on saving to the file.voidstore(OutputStream out) Store to output stream.voidprotected abstract voidstoreInternal(BufferedWriter bw, boolean escUnicode) Store data to buffer writer.protected static voidwriteComments(BufferedWriter bw, String comments) 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.IFileEditor
getData, isEmpty
-
Field Details
-
FILE_COMMENT_PREFIX
- See Also:
-
file
protected final org.eclipse.core.resources.IFile file -
dirty
protected volatile boolean dirty
-
-
Constructor Details
-
AbstractPropertiesFileEditor
protected AbstractPropertiesFileEditor(org.eclipse.core.resources.IFile file) Instantiates a new abstract properties file editor.- Parameters:
file- the file, cannot benull.
-
-
Method Details
-
getFile
public org.eclipse.core.resources.IFile getFile()Description copied from interface:IFileEditorGets the file that was loaded.- Specified by:
getFilein interfaceIFileEditor<T>- Returns:
- the file
-
delete
public void delete()Description copied from interface:IFileEditorDelete storage file, associated with this object.- Specified by:
deletein interfaceIFileEditor<T>
-
isDirty
public boolean isDirty()Description copied from interface:IFileEditorChecks if the file is dirty.- Specified by:
isDirtyin interfaceIFileEditor<T>- Returns:
- the boolean
-
markDirty
public void markDirty()Description copied from interface:IFileEditorMark the file as dirty.- Specified by:
markDirtyin interfaceIFileEditor<T>
-
save
public byte[] save(com.google.common.hash.HashFunction hashFunction, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException Description copied from interface:IFileEditorStore translations to the file.- Specified by:
savein interfaceIFileEditor<T>monitor- the monitor- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Description copied from interface:IFileEditorStore translations to the file.- Specified by:
savein interfaceIFileEditor<T>- Parameters:
monitor- the monitor- Throws:
IOException- Signals that an I/O exception has occurred.
-
store
- Throws:
IOException
-
storeInternal
Store data to buffer writer.- Parameters:
bw- the buffer writerescUnicode- the escape unicode symbols- Throws:
IOException- Signals that an I/O exception has occurred.- See Also:
-
store
Store to output stream.- Parameters:
out- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
load
public void load()Description copied from interface:IFileEditorLoad from the resource file.- Specified by:
loadin interfaceIFileEditor<T>
-
load
- Throws:
IOException
-
loadInternal
protected abstract void loadInternal(com.e1c.langtool.storage.properties.LineReader lr) throws IOException Load content form line reader.- Parameters:
lr- the line reader- Throws:
IOException- Signals that an I/O exception has occurred.- See Also:
-
loadConvert
-
saveConvert
Convert string on saving to the file.- Parameters:
theString- the the string to convertescapeSpaceAndDot- the escape space and dot- Returns:
- the converted string
-
writeComments
- Throws:
IOException
-