Package org.languagetool.gui
Class Main
- java.lang.Object
-
- org.languagetool.gui.Main
-
public final class Main extends java.lang.ObjectA simple GUI to check texts with.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classMain.AboutAction(package private) classMain.AddRulesAction(package private) classMain.AutoCheckAction(package private) classMain.CheckAction(package private) classMain.CheckClipboardAction(package private) classMain.ClearTextAction(package private) classMain.CloseListenerprivate classMain.ControlReturnTextCheckingListener(package private) classMain.HideAction(package private) classMain.OpenAction(package private) classMain.OptionsAction(package private) static classMain.PlainTextFileFilter(package private) classMain.QuitAction(package private) classMain.RecentFileAction(package private) classMain.SaveAction(package private) classMain.SaveAsActionprivate classMain.SelectAllAction(package private) classMain.SelectFontAction(package private) classMain.SelectLFAction(package private) classMain.ShowResultAction(package private) classMain.TagTextActionclassMain.TextLineNumberThis class will display line numbers for a related text component.(package private) classMain.TrayActionItemListener(package private) classMain.TrayActionListener(package private) classMain.TrayActionRMBListener
-
Field Summary
Fields Modifier and Type Field Description private Main.AutoCheckActionautoCheckActionprivate org.apache.commons.io.ByteOrderMarkbomprivate Main.CheckActioncheckActionprivate booleancloseHidesToTrayprivate java.util.Map<org.languagetool.Language,ConfigurationDialog>configDialogsprivate java.io.FilecurrentFileprivate java.awt.CheckboxMenuItemenableHttpServerItem(package private) static java.lang.StringEXTERNAL_LANGUAGE_SUFFIXprivate java.util.List<org.languagetool.Language>externalLanguagesprivate FontChooserfontChooserDialogprivate javax.swing.JFrameframeprivate static java.lang.StringGUI_STATEprivate static java.lang.StringHTML_FONT_ENDprivate static java.lang.StringHTML_FONT_STARTprivate HTTPServerhttpServerprivate booleanisInTrayprivate LanguageComboBoxlanguageBoxprivate LocalStoragelocalStorageprivate LanguageToolSupportltSupportprivate javax.swing.JPanelmainPanelprivate static intMAX_RECENT_FILESprivate java.util.ResourceBundlemessagesprivate javax.swing.JScrollPanenumberedTextAreaPaneprivate Main.OpenActionopenActionprivate org.apache.commons.collections4.queue.CircularFifoQueue<java.lang.String>recentFilesprivate javax.swing.JMenurecentFilesMenuprivate javax.swing.JTextPaneresultAreaprivate Main.SaveActionsaveActionprivate Main.SaveAsActionsaveAsActionprivate Main.ShowResultActionshowResultActionprivate javax.swing.JSplitPanesplitPaneprivate javax.swing.JLabelstatusLabelprivate static java.lang.StringTAG_COLORprivate javax.swing.JTextPanetaggerAreaprivate javax.swing.JDialogtaggerDialogprivate booleantaggerShowsDisambigLogprivate javax.swing.JTextAreatextAreaprivate Main.TextLineNumbertextLineNumberprivate static java.lang.StringTRAY_ICONprivate static java.lang.StringTRAY_SERVER_ICONprivate static java.lang.StringTRAY_SMALL_ICONprivate static java.lang.StringTRAY_SMALL_SERVER_ICONprivate static java.lang.StringTRAY_TOOLTIPprivate java.awt.TrayIcontrayIconprivate UndoRedoSupportundoRedoprivate static intWINDOW_HEIGHTprivate static intWINDOW_WIDTH
-
Constructor Summary
Constructors Modifier Constructor Description privateMain(LocalStorage localStorage)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddLanguage()private voidaddLookAndFeelMenuItem(javax.swing.JMenu lafMenu, javax.swing.UIManager.LookAndFeelInfo laf, javax.swing.ButtonGroup buttonGroup)private booleanappendTagsWithDisambigLog(java.lang.StringBuilder sb, org.languagetool.AnalyzedSentence sentence, boolean odd)private voidcheckClipboardText()private voidcheckTextAndDisplayResults()private voidcreateGUI()private javax.swing.JMenuBarcreateMenuBar()private java.lang.StringgetClipboardText()private ConfigurationDialoggetCurrentConfigDialog()private java.awt.ComponentgetFrame()private javax.swing.ImageIcongetImageIcon(java.lang.String filename)private java.lang.StringgetLabel(java.lang.String key)private javax.swing.KeyStrokegetMenuKeyStroke(int keyEvent)private intgetMnemonic(java.lang.String key)private java.lang.StringgetStackTraceAsHtml(java.lang.Exception e)private voidhideToTray()private voidloadFile()private voidloadFile(java.io.File file)private voidloadRecentFiles()static voidmain(java.lang.String[] args)private java.awt.PopupMenumakePopupMenu()private booleanmaybeStartServer()private static voidprintUsage()private voidquit()private voidquitOrHide()private voidrestoreFromTray()private voidrestoreFromTrayAndCheck()private voidsaveFile(boolean newFile)private voidsetLookAndFeel()private voidsetResultAreaVisible(boolean enable)private voidsetTrayIcon()private voidsetTrayMode(boolean trayMode)private voidsetWaitCursor()private voidshowGUI()private voidshowOptions()private voidshowSelectFontDialog()private voidstopServer()private voidtagText()private voidtagTextAndDisplayResults()private voidunsetWaitCursor()private voidupdateRecentFilesMenu()private voidupdateTitle()
-
-
-
Field Detail
-
EXTERNAL_LANGUAGE_SUFFIX
static final java.lang.String EXTERNAL_LANGUAGE_SUFFIX
- See Also:
- Constant Field Values
-
HTML_FONT_START
private static final java.lang.String HTML_FONT_START
- See Also:
- Constant Field Values
-
HTML_FONT_END
private static final java.lang.String HTML_FONT_END
- See Also:
- Constant Field Values
-
TRAY_ICON
private static final java.lang.String TRAY_ICON
- See Also:
- Constant Field Values
-
TRAY_SERVER_ICON
private static final java.lang.String TRAY_SERVER_ICON
- See Also:
- Constant Field Values
-
TRAY_SMALL_ICON
private static final java.lang.String TRAY_SMALL_ICON
- See Also:
- Constant Field Values
-
TRAY_SMALL_SERVER_ICON
private static final java.lang.String TRAY_SMALL_SERVER_ICON
- See Also:
- Constant Field Values
-
TRAY_TOOLTIP
private static final java.lang.String TRAY_TOOLTIP
- See Also:
- Constant Field Values
-
TAG_COLOR
private static final java.lang.String TAG_COLOR
- See Also:
- Constant Field Values
-
GUI_STATE
private static final java.lang.String GUI_STATE
- See Also:
- Constant Field Values
-
WINDOW_WIDTH
private static final int WINDOW_WIDTH
- See Also:
- Constant Field Values
-
WINDOW_HEIGHT
private static final int WINDOW_HEIGHT
- See Also:
- Constant Field Values
-
MAX_RECENT_FILES
private static final int MAX_RECENT_FILES
- See Also:
- Constant Field Values
-
messages
private final java.util.ResourceBundle messages
-
externalLanguages
private final java.util.List<org.languagetool.Language> externalLanguages
-
frame
private javax.swing.JFrame frame
-
taggerDialog
private javax.swing.JDialog taggerDialog
-
taggerArea
private javax.swing.JTextPane taggerArea
-
textArea
private javax.swing.JTextArea textArea
-
textLineNumber
private Main.TextLineNumber textLineNumber
-
numberedTextAreaPane
private javax.swing.JScrollPane numberedTextAreaPane
-
resultArea
private javax.swing.JTextPane resultArea
-
languageBox
private LanguageComboBox languageBox
-
enableHttpServerItem
private java.awt.CheckboxMenuItem enableHttpServerItem
-
httpServer
private HTTPServer httpServer
-
trayIcon
private java.awt.TrayIcon trayIcon
-
closeHidesToTray
private boolean closeHidesToTray
-
isInTray
private boolean isInTray
-
taggerShowsDisambigLog
private boolean taggerShowsDisambigLog
-
ltSupport
private LanguageToolSupport ltSupport
-
openAction
private Main.OpenAction openAction
-
saveAction
private Main.SaveAction saveAction
-
saveAsAction
private Main.SaveAsAction saveAsAction
-
autoCheckAction
private Main.AutoCheckAction autoCheckAction
-
showResultAction
private Main.ShowResultAction showResultAction
-
checkAction
private Main.CheckAction checkAction
-
currentFile
private java.io.File currentFile
-
bom
private org.apache.commons.io.ByteOrderMark bom
-
undoRedo
private UndoRedoSupport undoRedo
-
statusLabel
private final javax.swing.JLabel statusLabel
-
fontChooserDialog
private FontChooser fontChooserDialog
-
recentFiles
private final org.apache.commons.collections4.queue.CircularFifoQueue<java.lang.String> recentFiles
-
recentFilesMenu
private javax.swing.JMenu recentFilesMenu
-
localStorage
private final LocalStorage localStorage
-
configDialogs
private final java.util.Map<org.languagetool.Language,ConfigurationDialog> configDialogs
-
splitPane
private javax.swing.JSplitPane splitPane
-
mainPanel
private final javax.swing.JPanel mainPanel
-
-
Constructor Detail
-
Main
private Main(LocalStorage localStorage)
-
-
Method Detail
-
loadFile
private void loadFile()
-
loadFile
private void loadFile(java.io.File file)
-
saveFile
private void saveFile(boolean newFile)
-
addLanguage
private void addLanguage() throws java.lang.InstantiationException, java.lang.IllegalAccessException- Throws:
java.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
showOptions
private void showOptions()
-
showSelectFontDialog
private void showSelectFontDialog()
-
getFrame
private java.awt.Component getFrame()
-
updateTitle
private void updateTitle()
-
createGUI
private void createGUI()
-
getLabel
private java.lang.String getLabel(java.lang.String key)
-
getMnemonic
private int getMnemonic(java.lang.String key)
-
getMenuKeyStroke
private javax.swing.KeyStroke getMenuKeyStroke(int keyEvent)
-
createMenuBar
private javax.swing.JMenuBar createMenuBar()
-
updateRecentFilesMenu
private void updateRecentFilesMenu()
-
loadRecentFiles
private void loadRecentFiles()
-
addLookAndFeelMenuItem
private void addLookAndFeelMenuItem(javax.swing.JMenu lafMenu, javax.swing.UIManager.LookAndFeelInfo laf, javax.swing.ButtonGroup buttonGroup)
-
setLookAndFeel
private void setLookAndFeel()
-
makePopupMenu
private java.awt.PopupMenu makePopupMenu()
-
checkClipboardText
private void checkClipboardText()
-
hideToTray
private void hideToTray()
-
tagText
private void tagText()
-
quitOrHide
private void quitOrHide()
-
quit
private void quit()
-
setTrayIcon
private void setTrayIcon()
-
showGUI
private void showGUI()
-
restoreFromTray
private void restoreFromTray()
-
restoreFromTrayAndCheck
private void restoreFromTrayAndCheck()
-
getClipboardText
private java.lang.String getClipboardText()
-
maybeStartServer
private boolean maybeStartServer()
-
stopServer
private void stopServer()
-
checkTextAndDisplayResults
private void checkTextAndDisplayResults()
-
getStackTraceAsHtml
private java.lang.String getStackTraceAsHtml(java.lang.Exception e)
-
setWaitCursor
private void setWaitCursor()
-
unsetWaitCursor
private void unsetWaitCursor()
-
appendTagsWithDisambigLog
private boolean appendTagsWithDisambigLog(java.lang.StringBuilder sb, org.languagetool.AnalyzedSentence sentence, boolean odd)
-
tagTextAndDisplayResults
private void tagTextAndDisplayResults()
-
setResultAreaVisible
private void setResultAreaVisible(boolean enable)
-
setTrayMode
private void setTrayMode(boolean trayMode)
-
main
public static void main(java.lang.String[] args)
-
printUsage
private static void printUsage()
-
getImageIcon
private javax.swing.ImageIcon getImageIcon(java.lang.String filename)
-
getCurrentConfigDialog
private ConfigurationDialog getCurrentConfigDialog()
-
-