Package org.omegat.gui.editor
Interface IEditor
-
- All Known Implementing Classes:
ConsoleBindings,EditorController
public interface IEditorInterface for access to editor functionality. Almost all methods must be called from UI thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIEditor.CaretPositionStorage for caret position and selection.static classIEditor.CHANGE_CASE_TO
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidactivateEntry()Activate entry for edit.voidchangeCase(IEditor.CHANGE_CASE_TO newCase)Change case of the selected text or if none is selected, of the current word.voidcommitAndDeactivate()Commits the translation and deactivate entry.voidcommitAndLeave()Commits the translation and leave entry activated.IAutoCompletergetAutoCompleter()Access the AutoCompleterSourceTextEntrygetCurrentEntry()Get current active entry.intgetCurrentEntryNumber()Get current active entry number.java.lang.StringgetCurrentFile()Get relative path (undersource) of the source file currently open in the editor.java.lang.StringgetCurrentTargetFile()Get the relative path (undertarget) of the target file corresponding to the current source file (pergetCurrentFile()).java.lang.StringgetCurrentTranslation()Returns current translation or null.IEditorFiltergetFilter()Gets a filter for this editor, or null if filter doesn't applied.java.lang.StringgetSelectedText()Get currently selected text.IEditorSettingsgetSettings()Get settings instance.voidgotoEntry(int entryNum)Goto entry with specified number.voidgotoEntry(int entryNum, IEditor.CaretPosition pos)Goto entry with specified number, and restore caret to specified position.voidgotoEntry(java.lang.String srcString, EntryKey key)Goto entry based on a string and entry key.voidgotoEntryAfterFix(int fixedEntry, java.lang.String fixedSource)Goto entry with specified number while avoiding clobbering the tag fixes.voidgotoFile(int fileIndex)Goto first entry in specified file.voidgotoHistoryBack()Go to previous segment from history.voidgotoHistoryForward()Go to next segment from history.voidinsertTag(java.lang.String tag)Inserts tag at the cursor position, probably with adding bidi control chars.voidinsertText(java.lang.String text)Inserts text at the cursor position.voidinsertTextAndMark(java.lang.String text)Inserts text at the cursor position and mark as to be changed by the translator, i.e, background of segment should be marked Must be called only from UI thread.voidmarkActiveEntrySource(SourceTextEntry requiredActiveEntry, java.util.List<Mark> marks, java.lang.String markerClassName)All plugins can call this method for mark something in active entry.voidnextEntry()Move to next entry.voidnextEntryWithNote()Move to next entry with a note.voidnextTranslatedEntry()Move to next translated entry.voidnextUniqueEntry()Move to the first non-unique entry.voidnextUntranslatedEntry()Move to next untranslated entry.voidnextXAutoEntry()Move to next x-auto translated entry.voidnextXEnforcedEntry()Move to next x-enforced translated entry.voidprevEntry()Move to previous entry.voidprevEntryWithNote()Move to previous entry with a note.voidprevXAutoEntry()Move to previous x-auto translated entry.voidprevXEnforcedEntry()Move to previous x-enforced translated entry.voidredo()Redo editing.voidrefreshView(boolean doCommit)voidrefreshViewAfterFix(java.util.List<java.lang.Integer> fixedEntries)Refresh the current editor view while avoiding clobbering any tag fixes.voidregisterEmptyTranslation()Register as empty.voidregisterIdenticalTranslation()Register translation to be identical to source.voidregisterPopupMenuConstructors(int priority, IPopupMenuConstructor constructor)Register constructor of popup menu.voidregisterUntranslated()Register untranslated.voidremarkOneMarker(java.lang.String markerClassName)Calls specified marker for reprocess all entries.voidremoveFilter()Removes the current filter.voidreplaceEditText(java.lang.String text)Replaces the entire edit area with a given text.voidreplaceEditText(java.lang.String text, java.lang.String origin)Replaces the entire edit area with a given text which origin is origin.voidreplaceEditTextAndMark(java.lang.String text)Inserts text at the cursor position and mark as to be changed by the translator, i.e, background of segment should be marked Must be called only from UI thread.voidreplaceEditTextAndMark(java.lang.String text, java.lang.String origin)Replace text and mark as to be changed by the translator from origin, i.e, background of segment should be marked Must be called only from UI thread.voidrequestFocus()Set current focus to editor.voidselectSourceText()Select the source text of the current segment.voidsetAlternateTranslationForCurrentEntry(boolean alternate)Set default/alternate translation for current entry.voidsetFilter(IEditorFilter filter)Sets a filter to this editor.voidundo()Undo editing.voidwindowDeactivated()Perform any necessary actions for window deactivation.
-
-
-
Method Detail
-
getCurrentFile
java.lang.String getCurrentFile()
Get relative path (undersource) of the source file currently open in the editor.Can be called from any thread.
-
getCurrentTargetFile
java.lang.String getCurrentTargetFile()
Get the relative path (undertarget) of the target file corresponding to the current source file (pergetCurrentFile()). This file is what is created upon doing Create Target Documents, but it may not exist yet.Can be called from any thread.
-
getCurrentEntry
SourceTextEntry getCurrentEntry()
Get current active entry. Can be called from any thread.
-
getCurrentEntryNumber
int getCurrentEntryNumber()
Get current active entry number. Can be called from any thread.
-
activateEntry
void activateEntry()
Activate entry for edit. Must be called only from UI thread. Will position cursor at the start of segment
-
commitAndDeactivate
void commitAndDeactivate()
Commits the translation and deactivate entry. Translation will be saved. Must be called only from UI thread.
-
commitAndLeave
void commitAndLeave()
Commits the translation and leave entry activated. Translation will be saved. Must be called only from UI thread.
-
nextEntry
void nextEntry()
Move to next entry. Must be called only from UI thread.
-
prevEntry
void prevEntry()
Move to previous entry. Must be called only from UI thread.
-
nextXAutoEntry
void nextXAutoEntry()
Move to next x-auto translated entry. Must be called only from UI thread.
-
prevXAutoEntry
void prevXAutoEntry()
Move to previous x-auto translated entry. Must be called only from UI thread.
-
nextXEnforcedEntry
void nextXEnforcedEntry()
Move to next x-enforced translated entry. Must be called only from UI thread.
-
prevXEnforcedEntry
void prevXEnforcedEntry()
Move to previous x-enforced translated entry. Must be called only from UI thread.
-
nextEntryWithNote
void nextEntryWithNote()
Move to next entry with a note. Must be called only from UI thread.
-
prevEntryWithNote
void prevEntryWithNote()
Move to previous entry with a note. Must be called only from UI thread.
-
nextUntranslatedEntry
void nextUntranslatedEntry()
Move to next untranslated entry. Must be called only from UI thread.
-
nextTranslatedEntry
void nextTranslatedEntry()
Move to next translated entry. Must be called only from UI thread.
-
nextUniqueEntry
void nextUniqueEntry()
Move to the first non-unique entry. Must be called from UI thread.
-
gotoFile
void gotoFile(int fileIndex) throws java.lang.IndexOutOfBoundsExceptionGoto first entry in specified file.- Parameters:
fileIndex- file index in project- Throws:
java.lang.IndexOutOfBoundsException- If there is no file for the given index
-
gotoEntry
void gotoEntry(int entryNum)
Goto entry with specified number. Convenience method forgotoEntry(int, CaretPosition)where the caret position will be the start of the entry.- Parameters:
entryNum- entry number, starts from 1 Must be called only from UI thread.
-
gotoEntry
void gotoEntry(int entryNum, IEditor.CaretPosition pos)Goto entry with specified number, and restore caret to specified position.- Parameters:
entryNum- entry number, starts from 1 Must be called only from UI thread.
-
gotoEntry
void gotoEntry(java.lang.String srcString, EntryKey key)Goto entry based on a string and entry key.- Parameters:
srcString- entry source stringkey- entry key (can be null) Must be called only from UI thread.
-
gotoEntryAfterFix
void gotoEntryAfterFix(int fixedEntry, java.lang.String fixedSource)Goto entry with specified number while avoiding clobbering the tag fixes.- Parameters:
fixedEntry- entry number, starts from 1fixedSource- The source of the entry that was fixed Must be called only from UI thread.
-
refreshViewAfterFix
void refreshViewAfterFix(java.util.List<java.lang.Integer> fixedEntries)
Refresh the current editor view while avoiding clobbering any tag fixes.- Parameters:
fixedEntries- A list of all entries that were altered Must be called only from UI thread.
-
refreshView
void refreshView(boolean doCommit)
-
requestFocus
void requestFocus()
Set current focus to editor.
-
changeCase
void changeCase(IEditor.CHANGE_CASE_TO newCase)
Change case of the selected text or if none is selected, of the current word.- Parameters:
newCase- : lower, title, upper or cycle Must be called only from UI thread.
-
replaceEditText
void replaceEditText(java.lang.String text, java.lang.String origin)Replaces the entire edit area with a given text which origin is origin.when manual edit and origin is unknown, origin will be null. Must be called only from UI thread.
-
replaceEditText
void replaceEditText(java.lang.String text)
Replaces the entire edit area with a given text. Must be called only from UI thread.
-
replaceEditTextAndMark
void replaceEditTextAndMark(java.lang.String text, java.lang.String origin)Replace text and mark as to be changed by the translator from origin, i.e, background of segment should be marked Must be called only from UI thread.
-
replaceEditTextAndMark
void replaceEditTextAndMark(java.lang.String text)
Inserts text at the cursor position and mark as to be changed by the translator, i.e, background of segment should be marked Must be called only from UI thread.
-
insertText
void insertText(java.lang.String text)
Inserts text at the cursor position. Must be called only from UI thread.
-
insertTextAndMark
void insertTextAndMark(java.lang.String text)
Inserts text at the cursor position and mark as to be changed by the translator, i.e, background of segment should be marked Must be called only from UI thread.- Parameters:
text- The text to insert
-
insertTag
void insertTag(java.lang.String tag)
Inserts tag at the cursor position, probably with adding bidi control chars. Must be called only from UI thread.
-
gotoHistoryForward
void gotoHistoryForward()
Go to next segment from history. Must be called only from UI thread.
-
gotoHistoryBack
void gotoHistoryBack()
Go to previous segment from history. Must be called only from UI thread.
-
getSettings
IEditorSettings getSettings()
Get settings instance.- Returns:
- interface for read and change editor settings Can be called from any thread.
-
undo
void undo()
Undo editing. Must be called only from UI thread.
-
redo
void redo()
Redo editing. Must be called only from UI thread.
-
getSelectedText
java.lang.String getSelectedText()
Get currently selected text.- Returns:
- selected text Must be called only from UI thread.
-
selectSourceText
void selectSourceText()
Select the source text of the current segment.
-
setAlternateTranslationForCurrentEntry
void setAlternateTranslationForCurrentEntry(boolean alternate)
Set default/alternate translation for current entry.
-
markActiveEntrySource
void markActiveEntrySource(SourceTextEntry requiredActiveEntry, java.util.List<Mark> marks, java.lang.String markerClassName)
All plugins can call this method for mark something in active entry.- Parameters:
requiredActiveEntry- entry which should be active. If user moved to other entry, then marks will be skippedmarks- list of marksmarkerClassName- marker's class name
-
registerPopupMenuConstructors
void registerPopupMenuConstructors(int priority, IPopupMenuConstructor constructor)Register constructor of popup menu.- Parameters:
priority- priority of process orderconstructor- constructor instance
-
remarkOneMarker
void remarkOneMarker(java.lang.String markerClassName)
Calls specified marker for reprocess all entries.
-
getFilter
IEditorFilter getFilter()
Gets a filter for this editor, or null if filter doesn't applied.
-
setFilter
void setFilter(IEditorFilter filter)
Sets a filter to this editor. The filter causes only the selected entries to be shown in the editor.- Parameters:
filter- Filter instance
-
removeFilter
void removeFilter()
Removes the current filter.
-
getCurrentTranslation
java.lang.String getCurrentTranslation()
Returns current translation or null.
-
windowDeactivated
void windowDeactivated()
Perform any necessary actions for window deactivation.
-
registerUntranslated
void registerUntranslated()
Register untranslated.
-
registerEmptyTranslation
void registerEmptyTranslation()
Register as empty.
-
registerIdenticalTranslation
void registerIdenticalTranslation()
Register translation to be identical to source.
-
getAutoCompleter
IAutoCompleter getAutoCompleter()
Access the AutoCompleter
-
-