public class GlossaryManager extends java.lang.Object implements DirectoryMonitor.Callback
Modifier and Type | Field and Description |
---|---|
protected IGlossary[] |
externalGlossaries |
protected DirectoryMonitor |
monitor |
protected java.io.File |
priorityGlossary |
Constructor and Description |
---|
GlossaryManager(GlossaryTextArea pane) |
Modifier and Type | Method and Description |
---|---|
void |
addGlossaryProvider(IGlossary provider) |
static boolean |
createNewWritableGlossaryFile(java.io.File file)
Create new default writable glossary file.
|
void |
fileChanged(java.io.File file)
Called on any file changes - created, modified, deleted.
|
void |
forceReloadTBX() |
void |
forceUpdateGlossary() |
java.util.List<GlossaryEntry> |
getGlossaryEntries(java.lang.String src)
Get glossary entries.
|
java.util.List<GlossaryEntry> |
getLocalEntries()
Get glossary entries for search operation.
|
java.util.List<GlossaryEntry> |
searchSourceMatches(SourceTextEntry ste)
Get all glossary entries with source terms found in the provided string.
|
java.util.List<Token[]> |
searchSourceMatchTokens(SourceTextEntry ste,
GlossaryEntry entry)
Get tokens of the source text that match the supplied glossary entry.
|
java.util.List<java.lang.String> |
searchTargetMatches(java.lang.String trg,
ProtectedPart[] protectedParts,
GlossaryEntry entry)
Get all target terms for the provided glossary entry that can be found in the provided string.
|
void |
start() |
void |
stop() |
protected DirectoryMonitor monitor
protected java.io.File priorityGlossary
protected IGlossary[] externalGlossaries
public GlossaryManager(GlossaryTextArea pane)
public static boolean createNewWritableGlossaryFile(java.io.File file) throws java.io.IOException
file
- a file to be created.java.io.IOException
- when there is a problem to create file.public void addGlossaryProvider(IGlossary provider)
public void start()
public void stop()
public void fileChanged(java.io.File file)
DirectoryMonitor.Callback
fileChanged
in interface DirectoryMonitor.Callback
public void forceReloadTBX()
public void forceUpdateGlossary()
public java.util.List<GlossaryEntry> getGlossaryEntries(java.lang.String src)
src
- public java.util.List<GlossaryEntry> getLocalEntries()
public java.util.List<GlossaryEntry> searchSourceMatches(SourceTextEntry ste)
public java.util.List<Token[]> searchSourceMatchTokens(SourceTextEntry ste, GlossaryEntry entry)
ste
- The entry to searchpublic java.util.List<java.lang.String> searchTargetMatches(java.lang.String trg, ProtectedPart[] protectedParts, GlossaryEntry entry)
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