Package org.omegat.gui.glossary
Class GlossaryManager
java.lang.Object
org.omegat.gui.glossary.GlossaryManager
- All Implemented Interfaces:
DirectoryMonitor.Callback
Class that loads glossary files and adds glossary entries to strings of the
source files.
This class don't need any threads synchronization code, since it only set and clear 'glossaryEntries' var.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGlossaryProvider(IGlossary provider) static booleanCreate new default writable glossary file.voidfileChanged(File file) Called on any file changes - created, modified, deleted.voidvoidgetGlossaryEntries(String src) Get glossary entries.Get glossary entries for search operation.Get all glossary entries with source terms found in the provided string.searchSourceMatchTokens(SourceTextEntry ste, GlossaryEntry entry) Get tokens of the source text that match the supplied glossary entry.searchTargetMatches(String trg, ProtectedPart[] protectedParts, GlossaryEntry entry) Get all target terms for the provided glossary entry that can be found in the provided string.voidstart()voidstop()
-
Constructor Details
-
GlossaryManager
-
-
Method Details
-
createNewWritableGlossaryFile
Create new default writable glossary file.- Parameters:
file- a file to be created.- Returns:
- true if the file was successfully created
- Throws:
IOException- when there is a problem to create file.
-
addGlossaryProvider
-
start
public void start() -
stop
public void stop() -
fileChanged
Description copied from interface:DirectoryMonitor.CallbackCalled on any file changes - created, modified, deleted.- Specified by:
fileChangedin interfaceDirectoryMonitor.Callback
-
forceReloadTBX
public void forceReloadTBX() -
forceUpdateGlossary
public void forceUpdateGlossary() -
getGlossaryEntries
Get glossary entries.- Parameters:
src- keyword of the glossary to seek.- Returns:
- all entries
-
getLocalEntries
Get glossary entries for search operation. Almost the same as getGlossaryEntries(), except search usually executed for every segment in project, i.e. should work enough fast. Then, search should be produced by local files only.- Returns:
- all entries
-
searchSourceMatches
Get all glossary entries with source terms found in the provided string.- Returns:
- A list of matching glossary entries
-
searchSourceMatchTokens
Get tokens of the source text that match the supplied glossary entry.- Parameters:
ste- The entry to search- Returns:
- A list of tokens matching the supplied glossary entry
-
searchTargetMatches
public List<String> searchTargetMatches(String trg, ProtectedPart[] protectedParts, GlossaryEntry entry) Get all target terms for the provided glossary entry that can be found in the provided string.- Parameters:
trg- The text to searchprotectedParts- A list of protected parts from which matches should be disregarded (can be null)entry- The glossary entry whose target terms should be searched- Returns:
- A list of matching target terms
-