Package org.omegat.gui.search
Class SearchWindowController
- java.lang.Object
-
- org.omegat.gui.search.SearchWindowController
-
public class SearchWindowController extends java.lang.ObjectThis is a window that appears when user'd like to search for something. For each new user's request new window is created. Actual search is done by SearchThread.
-
-
Constructor Summary
Constructors Constructor Description SearchWindowController(SearchMode mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWindowListener(java.awt.event.WindowListener listener)voiddisplayErrorRB(java.lang.Throwable ex, java.lang.String errorKey, java.lang.Object... params)Display message dialog with the error as messagevoiddisplaySearchResult(Searcher searcher)Show search result for uservoiddispose()voidfocusSearchField()Focus the search field and select the current query textSearchModegetMode()java.lang.StringgetViewerSelection()Get the currently selected text in the search results panejavax.swing.JFramegetWindow()Get the search window framevoidinsertIntoActiveField(java.lang.String text)Insert the specified text into the currently active (focused) search field: either Search or ReplacevoidmakeVisible(java.lang.String query)Make Search window visible on screen, with optional initial query (may be null).voidreplaceCurrentFieldText(java.lang.String text)Replace the text of the currently active (focused) search field: either Search or ReplacevoidresetOptions()Reset search options to their default values.voidsetSearchText(java.lang.String text)Set the content of the search query
-
-
-
Constructor Detail
-
SearchWindowController
public SearchWindowController(SearchMode mode)
-
-
Method Detail
-
getMode
public SearchMode getMode()
-
resetOptions
public void resetOptions()
Reset search options to their default values. Search terms are left unchanged, as are any settings that don't affect the search results (such as syncing with editor).
-
displaySearchResult
public void displaySearchResult(Searcher searcher)
Show search result for user
-
dispose
public void dispose()
-
makeVisible
public void makeVisible(java.lang.String query)
Make Search window visible on screen, with optional initial query (may be null).- Parameters:
query- Initial query string (may be empty or null)
-
getViewerSelection
public java.lang.String getViewerSelection()
Get the currently selected text in the search results pane- Returns:
- Selected text, or
nullif none
-
setSearchText
public void setSearchText(java.lang.String text)
Set the content of the search query- Parameters:
text- The query text
-
focusSearchField
public void focusSearchField()
Focus the search field and select the current query text
-
insertIntoActiveField
public void insertIntoActiveField(java.lang.String text)
Insert the specified text into the currently active (focused) search field: either Search or Replace- Parameters:
text- The text to insert
-
replaceCurrentFieldText
public void replaceCurrentFieldText(java.lang.String text)
Replace the text of the currently active (focused) search field: either Search or Replace- Parameters:
text- The text to set
-
getWindow
public javax.swing.JFrame getWindow()
Get the search window frame- Returns:
- search window frame
-
addWindowListener
public void addWindowListener(java.awt.event.WindowListener listener)
-
displayErrorRB
public void displayErrorRB(java.lang.Throwable ex, java.lang.String errorKey, java.lang.Object... params)Display message dialog with the error as message- Parameters:
ex- exception to showerrorKey- error message key in resource bundleparams- error text parameters
-
-